[Haskell-cafe] Examples of Continuation monad that impossible to understand and maintain?

YueCompl compl.yue at icloud.com
Tue Aug 31 10:03:11 UTC 2021


Dear Cafe,

I'm wrapping up my CPS codebase to provide some monadic interface, it appears almost the Cont monad, so the following statement is a pretty valid caveat to me now:

> Abuse of the Continuation monad can produce code that is impossible to understand and maintain.

Which can be viewed in context of Hackage at: https://hackage.haskell.org/package/mtl/docs/Control-Monad-Cont.html#:~:text=Abuse%20of%20the%20Continuation%20monad%20can%20produce%20code%20that%20is%20impossible%20to%20understand%20and%20maintain <https://hackage.haskell.org/package/mtl/docs/Control-Monad-Cont.html#:~:text=Abuse of the Continuation monad can produce code that is impossible to understand and maintain> 

But I can't find concrete examples demonstrating the "impossible to understand and maintain" situation, in figuring out what pitfalls I'd rather to avoid.

Please share what you know about it, many appreciations!

Background of my CPS necessarity: 

Library code need to delegate STM transaction boundary delimitation to (scripting) application code, though `inlineSTM :: STM a -> m a` can be used to force some action to be within current tx, the usual `>>=` binding should honor whether a separate `atomically` tx should be issued for its rhs computation, as specified by the scripting context.

Thanks,
Compl

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20210831/7df2c806/attachment.html>


More information about the Haskell-Cafe mailing list