mtl, transformers, monads-fd, monadLib, and the paradox of choice

后端 未结 3 1866
孤独总比滥情好
孤独总比滥情好 2020-12-12 10:17

Hackage has several packages for monad transformers:

  • mtl: Monad transformer library
  • transformers: Concrete functor and monad transformers
  • mon
3条回答
  •  情书的邮戳
    2020-12-12 11:01

    For the moment? You should probably use mtl. What is happening is that the transformers library is being factored out of the MTL in a fashion that monads-fd and monads-tf can co-exist peacefully, but at last check that was not yet the case.

    When that happens you'll be able to import monads-fd and transformers and get (almost) the same interface, with the exception that State, etc. will be an alias for StateT.

    So I'd write to mtl, but not rely on the fact that State, Reader, etc. are currently data as they will be replaced with types.

    MonadLib is another alternative that Iavor has been working on, which can be safely used because it doesn't share any module names with the others, but which has a fairly different usage pattern.

提交回复
热议问题