parser-combinators-1.3.0: Lightweight package providing commonly useful parser combinators
Copyright© 2017–present Alex Washburn
LicenseBSD 3 clause
MaintainerMark Karpov <markkarpov92@gmail.com>
Stabilityexperimental
Portabilityportable
Safe HaskellSafe-Inferred
LanguageHaskell2010

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

Permutation type

data Permutation m a Source #

An Applicative wrapper-type for constructing permutation parsers.

Instances

Instances details
Functor m => Functor (Permutation m) Source # 
Instance details

Defined in Control.Monad.Permutations

Methods

fmap :: (a -> b) -> Permutation m a -> Permutation m b #

(<$) :: a -> Permutation m b -> Permutation m a #

Alternative m => Applicative (Permutation m) Source # 
Instance details

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 #

Permutation evaluators

runPermutation Source #

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.

intercalateEffect Source #

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

toPermutation Source #

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.