Converting monomorphic transformers stacks into eff polymorphic effects #186
eldritch-cookie
started this conversation in
Ideas
Replies: 2 comments 1 reply
-
instances for writerT and StateT instance (State s :> es,Effable es m) => Effable es (StateT s m) where
toEff ma = get >>= (toEff . runStateT ma) >>= \(a,s) -> put s >> return a
instance (Monoid w,Writer w :> es,Effable es m) => Effable es (WriterT w m) where
toEff ma = toEff (runWriterT ma) >>= \(a,w) -> tell w >> return a |
Beta Was this translation helpful? Give feedback.
0 replies
-
I'm not sure. Do I understand correctly that this is for embedding monad transformer stacks into Eff? What's the example use case? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
i have a compiling proof of concept for readerT
is this useful ? because i believe it possible to do at least for StateT and WriterT
my idea would be to use this with newtypes by using
the main problem i see with this idea is that from a specific newtyped monad we go to a generic effect.
but i probably could make a new effect which has all the operations necessary and go from Monad transformer to Eff es
Beta Was this translation helpful? Give feedback.
All reactions