最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

haskell - Does `ConduitT` have a corresponding class? - Stack Overflow

programmeradmin2浏览0评论

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 badges
Add a comment  | 

1 Answer 1

Reset to default 4

No, 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.

发布评论

评论列表(0)

  1. 暂无评论