You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
zoom'
::MonadStatesm=>LensLike' (Zoomed (States) a) st->StateTtIdentitya->ma
zoom' l = state . runState . zoom l
This function could be useful when you just want to edit the state quickly and don't need to do anything specific to the monad you're actually working in.
The text was updated successfully, but these errors were encountered:
I use l %%= runState modification for this, where modification :: State t a. Especially with BlockArguments it's not that unreadable, for example the following works fine for me
localEnv :: Lens' GlobalEnv LocalEnv
nextFreeId :: Lens' LocalEnv Int
bindings :: Lens' LocalEnv (Map Int Foo)
Reserved :: Foo
localEnv %%= runState do
newId <- nextFreeId <+= 1
bindings . at newId <?= Reserved
This function could be useful when you just want to edit the state quickly and don't need to do anything specific to the monad you're actually working in.
The text was updated successfully, but these errors were encountered: