Most monad transformers have a corresponding class, for instance, ReaderT
has MonadReader
, ResourceT
has MonadResource
, etc. This allows you to use the monad features without a chain of lift
calls.
I need to run a monad stack inside of a ConduitT
.... Is there a corresponding MonadConduit
or something where I could just call yield
or await
without the dreaded lift
chain? I've looked around a bit, haven't found anything...
(I need to run the monad stack inside of the ConduitT
, although I've noticed the problem seems to be the same if the ConduitT is inside the other monads also, lift
is required.... A conduit class would solve all of this, if it existed)
I suppose I could write a class like this myself, but there must be an approach that is commonly used already, if someone could point me to it.
Most monad transformers have a corresponding class, for instance, ReaderT
has MonadReader
, ResourceT
has MonadResource
, etc. This allows you to use the monad features without a chain of lift
calls.
I need to run a monad stack inside of a ConduitT
.... Is there a corresponding MonadConduit
or something where I could just call yield
or await
without the dreaded lift
chain? I've looked around a bit, haven't found anything...
(I need to run the monad stack inside of the ConduitT
, although I've noticed the problem seems to be the same if the ConduitT is inside the other monads also, lift
is required.... A conduit class would solve all of this, if it existed)
I suppose I could write a class like this myself, but there must be an approach that is commonly used already, if someone could point me to it.
Share Improve this question asked Mar 15 at 2:56 jamshidhjamshidh 12.1k20 silver badges31 bronze badges1 Answer
Reset to default 4No, there is no MonadConduit
-like class, and it is not a commonly used approach. The common approach is to write conduits using ConduitT i o m r
as the outer monad with an inner monad (or monad stack) m
. When using this approach, conduit operations are unlifted, but non-conduit operations are lifted normally via the various monad class instances (e.g., MonadIO
, MonadReader
, MonadState
, etc.) for ConduitT
.