cassette-0.2.0: A combinator library for simultaneously defining parsers and pretty printers.
Safe HaskellSafe-Inferred
LanguageHaskell2010

Text.Cassette.Internal.Tr

Synopsis

Documentation

type C r = (String -> r) -> String -> r Source #

The type of string transformers in CPS, i.e. functions from strings to strings.

newtype Tr r r' Source #

Tr r r' is the type of string transformers with answer type modification from r to r' through control effects.

Constructors

Tr 

Fields

Instances

Instances details
Category Tr Source # 
Instance details

Defined in Text.Cassette.Internal.Tr

Methods

id :: Tr a a #

(.) :: Tr b c -> Tr a b -> Tr a c #

Monoid (Tr r r') Source #

mempty is the string transformer that always fails.

Instance details

Defined in Text.Cassette.Internal.Tr

Methods

mempty :: Tr r r' #

mappend :: Tr r r' -> Tr r r' -> Tr r r' #

mconcat :: [Tr r r'] -> Tr r r' #

Semigroup (Tr r r') Source #

(<>) is the choice operator. Note that this is an unrestricted backtracking operator: it never commits to any particular choice.

Instance details

Defined in Text.Cassette.Internal.Tr

Methods

(<>) :: Tr r r' -> Tr r r' -> Tr r r' #

sconcat :: NonEmpty (Tr r r') -> Tr r r' #

stimes :: Integral b => b -> Tr r r' -> Tr r r' #

shift :: (C r -> Tr w r') -> Tr r r' Source #

Capture continuation up to the closest reset.

plug :: C r -> Tr r r' -> Tr w r' Source #

Inverse of shift.

replace :: C r -> Tr w r Source #

Replace the success continuation.

pushNeg :: a -> Tr (a -> r) r Source #

popNeg :: Tr r (a -> r) Source #

pushPos :: a -> Tr (r -> r') ((a -> r) -> r') Source #

popPos :: Tr ((a -> r) -> r') (r -> r') Source #