moo-nad
Version 0.1.0.1 revision 0 uploaded by DanielDiazCarrete.
Package meta
- Synopsis
- Invocation helpers for the ReaderT-record-of-functions style.
- Description
Using a record-of-functions as the environment of some reader-like monad is a common way of structuring Haskell applications, somewhat resembling dependency injection in OOP.
We often want our program logic to be polymorphic over both the concrete monad and the environment. One common solution is to abstract the monad using
MonadReader
, and abstract the environment usingHasX
-style typeclasses.One minor annoyance though is that invoking the function in the environment is often a bit cumbersome: you have to ask the environment for the function, and then lift the result of the function back into the reader-like monad.
This library supports a special twist on
ReaderT
-record-of-functions style: instead of depending only on typeclasses for abstraction, we also use a module signature. This comes with different tradeoffs.One benefit is that we support a simpler way of invoking functions from the environment, using a helper that takes care of both asking the environment and lifting function results, and which works uniformly for functions of any arity.
- Author
- Daniel Diaz Carrete
- Bug reports
- n/a
- Category
- n/a
- Copyright
- n/a
- Homepage
- n/a
- Maintainer
- diaz_carrete@yahoo.com
- Package URL
- n/a
- Stability
- n/a