symparsec
Safe HaskellNone
LanguageGHC2021

Symparsec.Parser.Alternative

Description

Type-level string parsers shaped like Alternative functions.

Synopsis

Documentation

data ((l :: PParser a) <|> (r :: PParser a)) (s :: FunKind PState (PReply a)) infixl 3 Source #

<|> for parsers. Try the left parser; if it succeeds, return the result, else try the right parser with the left parser's output state.

Does not backtrack. Wrap parsers with Try as needed.

TODO shitty errors

Instances

Instances details
type App (l <|> r :: FunKind PState (PReply a) -> Type) (s :: PState) Source # 
Instance details

Defined in Symparsec.Parser.Alternative

type App (l <|> r :: FunKind PState (PReply a) -> Type) (s :: PState)

data Empty (s :: FunKind PState (PReply a)) Source #

empty for parsers. Immediately fail with no consumption.

Instances

Instances details
type App (Empty :: FunKind PState (PReply a) -> Type) (s :: PState) Source # 
Instance details

Defined in Symparsec.Parser.Alternative

type App (Empty :: FunKind PState (PReply a) -> Type) (s :: PState) = 'Reply ('Err (Error1 "called empty parser") :: Result Symbol Natural a) s

type Optional (p :: PParser a) = (Con1 ('Just :: a -> Maybe a) <$> p) <|> Pure ('Nothing :: Maybe a) Source #

optional for parsers.