roundtrip-0.2.0.5: Bidirectional (de-)serialization

Safe HaskellNone
LanguageHaskell98

Text.Roundtrip.Combinators

Contents

Synopsis

Lexemes

char :: StringSyntax delta => Char -> delta () Source #

char' :: StringSyntax delta => Char -> delta Char Source #

string :: StringSyntax delta => String -> delta () Source #

string parses/prints a fixed text and consumes/produces a unit value.

comma :: StringSyntax delta => delta () Source #

dot :: StringSyntax delta => delta () Source #

Repetition

many :: Syntax delta => delta alpha -> delta [alpha] Source #

many1 :: Syntax delta => delta alpha -> delta [alpha] Source #

sepBy :: Syntax delta => delta alpha -> delta () -> delta [alpha] Source #

chainl1 :: Syntax delta => delta alpha -> delta beta -> Iso (alpha, (beta, alpha)) alpha -> delta alpha Source #

The chainl1 combinator is used to parse a left-associative chain of infix operators.

Sequencing

(*>) :: Syntax delta => delta () -> delta alpha -> delta alpha infixr 6 Source #

This variant of <*> ignores its left result. In contrast to its counterpart derived from the Applicative class, the ignored parts have type `delta ()` rather than `delta beta` because otherwise information relevant for pretty-printing would be lost.

(<*) :: Syntax delta => delta alpha -> delta () -> delta alpha infixr 6 Source #

This variant of <*> ignores its right result. In contrast to its counterpart derived from the Applicative class, the ignored parts have type `delta ()` rather than `delta beta` because otherwise information relevant for pretty-printing would be lost.

between :: Syntax delta => delta () -> delta () -> delta alpha -> delta alpha Source #

The between function combines *> and <* in the obvious way.

Alternation

(<+>) :: Syntax delta => delta alpha -> delta beta -> delta (Either alpha beta) infixl 4 Source #

optional :: Syntax delta => delta alpha -> delta (Maybe alpha) Source #

optionalBool :: Syntax delta => delta () -> delta Bool Source #

optionalWithDefault :: (Eq alpha, Syntax delta) => alpha -> delta alpha -> delta alpha Source #

Whitespace

skipSpace :: StringSyntax delta => delta () Source #

skipSpace marks a position where whitespace is allowed to occur. It accepts arbitrary space while parsing, and produces no space while printing.

sepSpace :: StringSyntax delta => delta () Source #

sepSpace marks a position where whitespace is required to occur. It requires one or more space characters while parsing, and produces a single space character while printing.

optSpace :: StringSyntax delta => delta () Source #

optSpace marks a position where whitespace is desired to occur. It accepts arbitrary space while parsing, and produces a single space character while printing.

XML

xmlElem :: XmlSyntax x => Name -> x a -> x a Source #

xmlAttr :: XmlSyntax x => Name -> Iso Text a -> x a Source #

xmlFixedAttr :: XmlSyntax x => Name -> Text -> x () Source #