| Copyright | © 2017–present Alex Washburn | 
|---|---|
| License | BSD 3 clause | 
| Maintainer | Mark Karpov <markkarpov92@gmail.com> | 
| Stability | experimental | 
| Portability | portable | 
| Safe Haskell | Safe-Inferred | 
| Language | Haskell2010 | 
Control.Monad.Permutations
Description
This module specialized the interface to Monad for potential efficiency
 considerations, depending on the monad the permutations are run over.
For a more general interface requiring only Applicative, and for more
 complete documentation, see the Permutations module.
Since: 1.3.0
Synopsis
- data Permutation m a
- runPermutation :: (Alternative m, Monad m) => Permutation m a -> m a
- intercalateEffect :: (Alternative m, Monad m) => m b -> Permutation m a -> m a
- toPermutation :: Alternative m => m a -> Permutation m a
- toPermutationWithDefault :: Alternative m => a -> m a -> Permutation m a
Permutation type
data Permutation m a Source #
An Applicative wrapper-type for constructing permutation parsers.
Instances
| Alternative m => Applicative (Permutation m) Source # | |
| Defined in Control.Monad.Permutations Methods pure :: a -> Permutation m a # (<*>) :: Permutation m (a -> b) -> Permutation m a -> Permutation m b # liftA2 :: (a -> b -> c) -> Permutation m a -> Permutation m b -> Permutation m c # (*>) :: Permutation m a -> Permutation m b -> Permutation m b # (<*) :: Permutation m a -> Permutation m b -> Permutation m a # | |
| Functor m => Functor (Permutation m) Source # | |
| Defined in Control.Monad.Permutations Methods fmap :: (a -> b) -> Permutation m a -> Permutation m b # (<$) :: a -> Permutation m b -> Permutation m a # | |
Permutation evaluators
Arguments
| :: (Alternative m, Monad m) | |
| => Permutation m a | Permutation specification | 
| -> m a | Resulting base monad capable of handling the permutation | 
"Unlifts" a permutation parser into a parser to be evaluated.
Arguments
| :: (Alternative m, Monad m) | |
| => m b | Effect to be intercalated between permutation components | 
| -> Permutation m a | Permutation specification | 
| -> m a | Resulting base monad capable of handling the permutation | 
"Unlifts" a permutation parser into a parser to be evaluated with an intercalated effect. Useful for separators between permutation elements.
Permutation constructors
Arguments
| :: Alternative m | |
| => m a | Permutation component | 
| -> Permutation m a | 
"Lifts" a parser to a permutation parser.
toPermutationWithDefault Source #
Arguments
| :: Alternative m | |
| => a | Default Value | 
| -> m a | Permutation component | 
| -> Permutation m a | 
"Lifts" a parser with a default value to a permutation parser.
If no permutation containing the supplied parser can be parsed from the input, then the supplied default value is returned in lieu of a parse result.