invertible-grammar-0.1.3.2: Invertible parsing combinators framework
Safe HaskellSafe
LanguageHaskell2010

Data.InvertibleGrammar.Generic

Synopsis

Documentation

with :: forall a b s t c d f p. (Generic a, MkPrismList (Rep a), MkStackPrism f, Rep a ~ M1 D d (M1 C c f), StackPrismLhs f t ~ b, Constructor c) => (Grammar p b (a :- t) -> Grammar p s (a :- t)) -> Grammar p s (a :- t) Source #

Provide a data constructor/stack isomorphism to a grammar working on stacks. Works for types with one data constructor. For sum types use match and Coproduct.

match :: (Generic a, MkPrismList (Rep a), Match (Rep a) bs t, bs ~ Coll (Rep a) t) => Coproduct p s bs a t -> Grammar p s (a :- t) Source #

Combine all grammars provided in Coproduct list into a single grammar.

data Coproduct p s bs a t where Source #

Heterogenous list of grammars, each one matches a data constructor of type a. With is used to provide a data constructor/stack isomorphism to a grammar working on stacks. End ends the list of matches.

Constructors

With :: (Grammar p b (a :- t) -> Grammar p s (a :- t)) -> Coproduct p s bs a t -> Coproduct p s (b ': bs) a t 
End :: Coproduct p s '[] a t