[Haskell-cafe] Zoom instance for Coroutine
Mario Blažević
blamario at ciktel.net
Mon Mar 14 22:34:43 UTC 2016
On 03/11/2016 02:35 AM, Konstantin Saveljev wrote:
> Hello,
>
> I am using monad-coroutine
> <https://hackage.haskell.org/package/monad-coroutine> package and have
> something like Coroutine (Await Int) (State MyState) Int (simplified
> version, for example purpose).
>
> MyState is deeply nested and I do a lot of modifications in it.
> Previously (with different data types) I was able to use zoom from
> lens <https://hackage.haskell.org/package/lens>in order to simplify
> the typing/view of code which operates on some subtree of the state, e.g.:
>
> |zoom (company.assets) $ dosomething.a = someComputation anotherthing.b
> = False this.that = "someString" |
> The problem I am having is that I cannot come up with instance
> Zoom for the Coroutine and was wondering if anyone is able to help me
> with that?
I don't know if it gets you instance Zoom, but you can combine zoom
with mapMonad to dive into a field of your state.
https://hackage.haskell.org/package/monad-coroutine-0.9.0.2/docs/Control-Monad-Coroutine.html#v:mapMonad
More information about the Haskell-Cafe
mailing list