Copyright | (c) Eamon Olive 2020 (c) Louis Hyde 2020 |
---|---|
License | AGPL-3 |
Maintainer | ejolive97@gmail.com |
Stability | experimental |
Safe Haskell | Safe |
Language | Haskell2010 |
Synopsis
- newtype ChoiceT f m a = ChoiceT ((forall x. f x -> m x) -> m a)
- runChoiceT :: (forall x. f x -> m x) -> ChoiceT f m a -> m a
- invmapChoiceT :: (forall x. n x -> m x) -> (m a -> n b) -> ChoiceT f m a -> ChoiceT f n b
Documentation
newtype ChoiceT f m a Source #
The choice monad transformer It takes a monad and enriches it with choice.
ChoiceT ((forall x. f x -> m x) -> m a) |
Instances
:: (forall x. f x -> m x) | A chooser which can perform selections over This type proves the theorem : chooser (fmap f x) = fmap f (chooser x) |
-> ChoiceT f m a | A monad transformed by |
-> m a | The initial monad with the |
Use a chooser to perform all the selections of a ChoiceT
.
This uses a sensible argument order unlike many of the other monad transformers.
invmapChoiceT :: (forall x. n x -> m x) -> (m a -> n b) -> ChoiceT f m a -> ChoiceT f n b Source #
Transforms the computation inside the ChoiceT
.
This function differs from other map functions over the monads in monad transformers in that it requires an additional function of type forall x . n x -> m x
.
This is because ChoiceT
is not a covariant functor over the category of monads, but rather an invariant functor.