effect-stack
Version 0.3 revision 0 uploaded by DanielWagner.
Package meta
- Synopsis
- Reducing the pain of transformer stacks with duplicated effects
- Description
The
mtl
provides a nice way to write monadic actions which take advantage of a particular kind of effect (say, statefulness or exception handling) without being forced to say exactly which monad is providing that effect. However, if a transformer stack includes two transformers that provide the given effect,mtl
does not provide a clean way to disambiguate which one is wanted; the topmost one is always chosen.This package provides tools for disambiguating without being forced to choose a particular transformer stack. It provides a separate stack for each kind of effect; you may then disambiguate by depth within each stack. For example, in a stack with two
StateT
transformers, one can writefoo :: MonadStateDepth 0 m a => m a foo = depthState @0 get
for access to the topmost state effects, or
bar :: MonadStateDepth 1 m a => m a bar = depthState @1 get
for access to the state from underneath the topmost
StateT
, no matter how deep in the stack the twoStateT
s are.See the readme for more detailed motivation, usage examples, and documentation.
- Author
- Daniel Wagner
- Bug reports
- n/a
- Category
- Control
- Copyright
- n/a
- Homepage
- n/a
- Maintainer
- me@dmwit.com
- Package URL
- n/a
- Stability
- n/a