Safe Haskell | Trustworthy |
---|---|
Language | Haskell2010 |
Synopsis
- iso :: (a -> b) -> (b -> a) -> Grammar p (a :- t) (b :- t)
- osi :: (b -> a) -> (a -> b) -> Grammar p (a :- t) (b :- t)
- partialIso :: (a -> b) -> (b -> Either Mismatch a) -> Grammar p (a :- t) (b :- t)
- partialOsi :: (a -> Either Mismatch b) -> (b -> a) -> Grammar p (a :- t) (b :- t)
- push :: a -> (a -> Bool) -> (a -> Mismatch) -> Grammar p t (a :- t)
- pair :: Grammar p (b :- (a :- t)) ((a, b) :- t)
- swap :: Grammar p (a :- (b :- t)) (b :- (a :- t))
- cons :: Grammar p ([a] :- (a :- t)) ([a] :- t)
- nil :: Grammar p t ([a] :- t)
- insert :: Eq k => k -> Mismatch -> Grammar p (v :- ([(k, v)] :- t)) ([(k, v)] :- t)
- insertMay :: Eq k => k -> Grammar p (Maybe v :- ([(k, v)] :- t)) ([(k, v)] :- t)
- toDefault :: Eq a => a -> Grammar p (Maybe a :- t) (a :- t)
- coproduct :: [Grammar p a b] -> Grammar p a b
- onHead :: Grammar p a b -> Grammar p (a :- t) (b :- t)
- onTail :: Grammar p ta tb -> Grammar p (h :- ta) (h :- tb)
- traversed :: Traversable f => Grammar p a b -> Grammar p (f a) (f b)
- flipped :: Grammar p a b -> Grammar p b a
- sealed :: Grammar p (a :- Void) (b :- Void) -> Grammar p a b
- coerced :: (Coercible a c, Coercible b d) => Grammar p (a :- t) (b :- t') -> Grammar p (c :- t) (d :- t')
- annotated :: Text -> Grammar p a b -> Grammar p a b
Documentation
osi :: (b -> a) -> (a -> b) -> Grammar p (a :- t) (b :- t) Source #
Flipped isomorphism on the stack head.
partialIso :: (a -> b) -> (b -> Either Mismatch a) -> Grammar p (a :- t) (b :- t) Source #
Partial isomorphism (for backward run) on the stack head.
partialOsi :: (a -> Either Mismatch b) -> (b -> a) -> Grammar p (a :- t) (b :- t) Source #
Partial isomorphism (for forward run) on the stack head.
push :: a -> (a -> Bool) -> (a -> Mismatch) -> Grammar p t (a :- t) Source #
Push an element to the stack on forward run, check if the element satisfies predicate, otherwise report a mismatch.
pair :: Grammar p (b :- (a :- t)) ((a, b) :- t) Source #
2-tuple grammar. Construct on forward run, deconstruct on backward run.
cons :: Grammar p ([a] :- (a :- t)) ([a] :- t) Source #
List cons-cell grammar. Construct on forward run, deconstruct on backward run.
nil :: Grammar p t ([a] :- t) Source #
Empty list grammar. Construct empty list on forward run, check if list is empty on backward run.
insert :: Eq k => k -> Mismatch -> Grammar p (v :- ([(k, v)] :- t)) ([(k, v)] :- t) Source #
Assoc-list element grammar. Inserts an element (with static key) on forward run, look up an element on backward run.
insertMay :: Eq k => k -> Grammar p (Maybe v :- ([(k, v)] :- t)) ([(k, v)] :- t) Source #
Optional assoc-list element grammar. Like insert
, but does not
report a mismatch on backward run. Instead takes and produces a
Maybe-value.
onHead :: Grammar p a b -> Grammar p (a :- t) (b :- t) Source #
Focus a given grammar to the stack head.
onTail :: Grammar p ta tb -> Grammar p (h :- ta) (h :- tb) Source #
Focus a given grammar to the stack tail.
traversed :: Traversable f => Grammar p a b -> Grammar p (f a) (f b) Source #
Traverse a structure with a given grammar.
sealed :: Grammar p (a :- Void) (b :- Void) -> Grammar p a b Source #
Run a grammar operating on the stack head in a context where there is no stack.