Has anyone ever encountered a Monad Transformer in the wild?

后端 未结 6 668
轮回少年
轮回少年 2021-01-30 12:36

In my area of business - back office IT for a financial institution - it is very common for a software component to carry a global configuration around, to log its progress, to

6条回答
  •  深忆病人
    2021-01-30 13:30

    Back when I was learning monads I built an application using a stack of StateT ContT IO to create a discrete event simulation library; the continuations were used to store monadic threads, with the StateT holding the runnable thread queue and other queues used for suspended threads waiting for various events. It worked quite well. I couldn't figure out how to write the Monad instance for a newtype wrapper, so I just made it a type synonym and that worked pretty well.

    These days I would probably have rolled my own monad from scratch. However whenever I do this I find myself looking at "All About Monads" and the source of the MTL to remind me what the bind operations look like, so in a sense I'm still thinking in terms of an MTL stack even though the result is a custom monad.

提交回复
热议问题