symparsec-1.1.1: Type level string parser combinators
Safe HaskellSafe-Inferred
LanguageGHC2021

Symparsec.Parser.Common

Description

Common definitions for parsers.

Synopsis

Re-exports

data Doc s #

Simple pretty document ADT.

Designed to work on both type level (as a limited ErrorMessage) and term level (as a boring ADT).

Note that ShowType is magical (see compilerGHCCore/Type.hs#L1309), so we need to remove it for term level.

singletons-base defines a version of this, but retains the ShowType constructor and is in the singletons ecosystem.

Constructors

Text s

plain ol' text

(Doc s) :<>: (Doc s)

append docs next to each other

(Doc s) :$$: (Doc s)

stack docs on top of each other (newline)

Instances

Instances details
Demotable SDoc 
Instance details

Defined in TypeLevelShow.Doc

Associated Types

type Demote SDoc #

Methods

demote :: forall (k1 :: k). SDoc k1 -> Demote SDoc #

SingDoc doc => SingI (doc :: PDoc) 
Instance details

Defined in TypeLevelShow.Doc

Associated Types

type Sing :: k -> Type #

Methods

sing' :: Sing doc #

Show s => Show (Doc s) 
Instance details

Defined in TypeLevelShow.Doc

Methods

showsPrec :: Int -> Doc s -> ShowS #

show :: Doc s -> String #

showList :: [Doc s] -> ShowS #

type Sing 
Instance details

Defined in TypeLevelShow.Doc

type Sing = SDoc
type Demote SDoc 
Instance details

Defined in TypeLevelShow.Doc

type (~>) a b = Fun a b infixr 0 #

An infix synonmy for Fun.

type (@@) (a1 :: a ~> k) (b :: a) = App a1 b infixl 9 #

An infix synonym for App.

Note: there is a term version which is a synonym to appLam.

type family App (f :: a ~> b) (x :: a) :: b #

Type level function application.

Instances

Instances details
type App ShowNatDigitHexLowerSym (d :: Natural) 
Instance details

Defined in TypeLevelShow.Natural.Digit

type App ShowNatDigitHexUpperSym (d :: Natural) 
Instance details

Defined in TypeLevelShow.Natural.Digit

type App IsAlphaSym (ch :: Char) Source # 
Instance details

Defined in Symparsec.Parser.While.Predicates

type App IsAlphaSym (ch :: Char) = IsAlpha ch
type App IsHexDigitSym (ch :: Char) Source # 
Instance details

Defined in Symparsec.Parser.While.Predicates

type App IsHexDigitSym (ch :: Char) = IsHexDigit ch
type App (IdSym :: FunKind a a -> Type) (x :: a) 
Instance details

Defined in DeFun.Function

type App (IdSym :: FunKind a a -> Type) (x :: a) = Id x
type App (Con1 f :: FunKind a b -> Type) (x :: a) 
Instance details

Defined in DeFun.Core

type App (Con1 f :: FunKind a b -> Type) (x :: a) = f x
type App (JoinSym1 f :: FunKind a b -> Type) (x :: a) 
Instance details

Defined in DeFun.Function

type App (JoinSym1 f :: FunKind a b -> Type) (x :: a) = Join f x
type App (ConstSym1 x :: FunKind b a -> Type) (y :: b) 
Instance details

Defined in DeFun.Function

type App (ConstSym1 x :: FunKind b a -> Type) (y :: b) = Const x y
type App (ApSym2 f g :: FunKind a c -> Type) (x :: a) 
Instance details

Defined in DeFun.Function

type App (ApSym2 f g :: FunKind a c -> Type) (x :: a) = Ap f g x
type App (CompSym2 f g :: FunKind a c -> Type) (x :: a) 
Instance details

Defined in DeFun.Function

type App (CompSym2 f g :: FunKind a c -> Type) (x :: a) = Comp f g x
type App (FlipSym2 f b2 :: FunKind a1 c -> Type) (a2 :: a1) 
Instance details

Defined in DeFun.Function

type App (FlipSym2 f b2 :: FunKind a1 c -> Type) (a2 :: a1) = Flip f b2 a2
type App TakeEndSym (s :: TakeS) Source # 
Instance details

Defined in Symparsec.Parser.Take

type App TakeEndSym (s :: TakeS) = TakeEnd s
type App SkipEndSym (n :: Natural) Source # 
Instance details

Defined in Symparsec.Parser.Skip

type App SkipEndSym (n :: Natural) = SkipEnd n
type App ParseDigitBinSym (ch :: Char) Source # 
Instance details

Defined in Symparsec.Parser.Natural.Digits

type App ParseDigitDecSym (ch :: Char) Source # 
Instance details

Defined in Symparsec.Parser.Natural.Digits

type App ParseDigitHexSym (ch :: Char) Source # 
Instance details

Defined in Symparsec.Parser.Natural.Digits

type App ParseDigitOctSym (ch :: Char) Source # 
Instance details

Defined in Symparsec.Parser.Natural.Digits

type App LiteralEndSym (s :: Symbol) Source # 
Instance details

Defined in Symparsec.Parser.Literal

type App (FailEndSym name e :: FunKind a (PResultEnd r) -> Type) (s :: a) Source # 
Instance details

Defined in Symparsec.Parser.Common

type App (FailEndSym name e :: FunKind a (PResultEnd r) -> Type) (s :: a) = 'Left ('EBase name e) :: Either (E Symbol) r
type App (ApplyEndSym f pEnd :: FunKind s1 (PResultEnd r') -> Type) (s2 :: s1) Source # 
Instance details

Defined in Symparsec.Parser.Apply

type App (ApplyEndSym f pEnd :: FunKind s1 (PResultEnd r') -> Type) (s2 :: s1) = ApplyEnd f pEnd s2
type App TakeChSym (f :: Char) Source # 
Instance details

Defined in Symparsec.Parser.Take

type App TakeChSym (f :: Char) = TakeChSym1 f
type App SkipChSym (f :: Char) Source # 
Instance details

Defined in Symparsec.Parser.Skip

type App SkipChSym (f :: Char) = SkipChSym1 f
type App TakeRestChSym (f :: Char) Source # 
Instance details

Defined in Symparsec.Parser.TakeRest

type App LiteralChSym (f :: Char) Source # 
Instance details

Defined in Symparsec.Parser.Literal

type App (TakeChSym1 ch :: FunKind TakeS (PResult TakeS Symbol) -> Type) (s :: TakeS) Source # 
Instance details

Defined in Symparsec.Parser.Take

type App (TakeChSym1 ch :: FunKind TakeS (PResult TakeS Symbol) -> Type) (s :: TakeS) = TakeCh ch s
type App (SkipChSym1 ch :: FunKind Natural (PResult Natural ()) -> Type) (n :: Natural) Source # 
Instance details

Defined in Symparsec.Parser.Skip

type App (SkipChSym1 ch :: FunKind Natural (PResult Natural ()) -> Type) (n :: Natural) = SkipCh ch n
type App (LiteralChSym1 ch :: FunKind Symbol (PResult Symbol ()) -> Type) (s :: Symbol) Source # 
Instance details

Defined in Symparsec.Parser.Literal

type App (LiteralChSym1 ch :: FunKind Symbol (PResult Symbol ()) -> Type) (s :: Symbol) = LiteralCh ch s
type App (NatBaseChSym base parseDigit :: FunKind Char (Maybe Natural ~> PResult (Maybe Natural) Natural) -> Type) (f :: Char) Source # 
Instance details

Defined in Symparsec.Parser.Natural

type App (NatBaseChSym base parseDigit :: FunKind Char (Maybe Natural ~> PResult (Maybe Natural) Natural) -> Type) (f :: Char) = NatBaseChSym1 base parseDigit f
type App (EndChSym :: FunKind Char (s ~> PResult s r) -> Type) (f :: Char) Source # 
Instance details

Defined in Symparsec.Parser.End

type App (EndChSym :: FunKind Char (s ~> PResult s r) -> Type) (f :: Char) = EndChSym1 f :: FunKind s (PResult s r) -> Type
type App (ConstSym :: FunKind a (b ~> a) -> Type) (x :: a) 
Instance details

Defined in DeFun.Function

type App (ConstSym :: FunKind a (b ~> a) -> Type) (x :: a) = ConstSym1 x :: FunKind b a -> Type
type App (EndChSym1 ch :: FunKind a (PResult a r) -> Type) (s :: a) Source # 
Instance details

Defined in Symparsec.Parser.End

type App (EndChSym1 ch :: FunKind a (PResult a r) -> Type) (s :: a) = 'Err ('EBase "End" ('Text "expected end of string")) :: Result Symbol a r
type App (CountChSym pCh s0 :: FunKind Char (CountS s r ~> PResult (CountS s r) [r]) -> Type) (f :: Char) Source # 
Instance details

Defined in Symparsec.Parser.Count

type App (CountChSym pCh s0 :: FunKind Char (CountS s r ~> PResult (CountS s r) [r]) -> Type) (f :: Char) = CountChSym1 pCh s0 f
type App (IsolateChSym pCh pEnd :: FunKind Char ((Natural, s) ~> PResult (Natural, s) r) -> Type) (f :: Char) Source # 
Instance details

Defined in Symparsec.Parser.Isolate

type App (IsolateChSym pCh pEnd :: FunKind Char ((Natural, s) ~> PResult (Natural, s) r) -> Type) (f :: Char) = IsolateChSym1 pCh pEnd f
type App (FailChSym name e :: FunKind Char (s ~> PResult s r) -> Type) (f :: Char) Source # 
Instance details

Defined in Symparsec.Parser.Common

type App (FailChSym name e :: FunKind Char (s ~> PResult s r) -> Type) (f :: Char)
type App (Con2 f :: FunKind a1 (a2 ~> b) -> Type) (arg :: a1) 
Instance details

Defined in DeFun.Core

type App (Con2 f :: FunKind a1 (a2 ~> b) -> Type) (arg :: a1) = Con1 (f arg)
type App (FlipSym1 f :: FunKind b (a ~> c) -> Type) (x :: b) 
Instance details

Defined in DeFun.Function

type App (FlipSym1 f :: FunKind b (a ~> c) -> Type) (x :: b) = FlipSym2 f x
type App (WhileChSym chPred pCh pEnd :: FunKind Char (s ~> PResult s r) -> Type) (f :: Char) Source # 
Instance details

Defined in Symparsec.Parser.While

type App (WhileChSym chPred pCh pEnd :: FunKind Char (s ~> PResult s r) -> Type) (f :: Char) = WhileChSym1 chPred pCh pEnd f
type App (ApplyChSym f pCh :: FunKind Char (s ~> PResult s r') -> Type) (x :: Char) Source # 
Instance details

Defined in Symparsec.Parser.Apply

type App (ApplyChSym f pCh :: FunKind Char (s ~> PResult s r') -> Type) (x :: Char) = ApplyChSym1 f pCh x
type App (Con3 f :: FunKind a1 (a2 ~> (b ~> c)) -> Type) (arg :: a1) 
Instance details

Defined in DeFun.Core

type App (Con3 f :: FunKind a1 (a2 ~> (b ~> c)) -> Type) (arg :: a1) = Con2 (f arg)
type App (WhileChSym1 chPred pCh pEnd ch :: FunKind s1 (PResult s1 r) -> Type) (s2 :: s1) Source # 
Instance details

Defined in Symparsec.Parser.While

type App (WhileChSym1 chPred pCh pEnd ch :: FunKind s1 (PResult s1 r) -> Type) (s2 :: s1) = WhileCh chPred pCh pEnd ch s2
type App (ApplyChSym1 f pCh ch :: FunKind s1 (PResult s1 r') -> Type) (s2 :: s1) Source # 
Instance details

Defined in Symparsec.Parser.Apply

type App (ApplyChSym1 f pCh ch :: FunKind s1 (PResult s1 r') -> Type) (s2 :: s1) = ApplyCh f pCh ch s2
type App (ThenChSym plCh prCh s0r :: FunKind Char (Either sl (rl, sr) ~> PResult (Either sl (rl, sr)) (rl, rr)) -> Type) (f :: Char) Source # 
Instance details

Defined in Symparsec.Parser.Then

type App (ThenChSym plCh prCh s0r :: FunKind Char (Either sl (rl, sr) ~> PResult (Either sl (rl, sr)) (rl, rr)) -> Type) (f :: Char) = ThenChSym1 plCh prCh s0r f
type App (ThenVRChSym plCh prCh s0r :: FunKind Char (Either sl (rl, sr) ~> PResult (Either sl (rl, sr)) rl) -> Type) (f :: Char) Source # 
Instance details

Defined in Symparsec.Parser.Then.VoidRight

type App (ThenVRChSym plCh prCh s0r :: FunKind Char (Either sl (rl, sr) ~> PResult (Either sl (rl, sr)) rl) -> Type) (f :: Char) = ThenVRChSym1 plCh prCh s0r f
type App (ThenVLChSym plCh prCh s0r :: FunKind Char (Either sl sr ~> PResult (Either sl sr) rr) -> Type) (f :: Char) Source # 
Instance details

Defined in Symparsec.Parser.Then.VoidLeft

type App (ThenVLChSym plCh prCh s0r :: FunKind Char (Either sl sr ~> PResult (Either sl sr) rr) -> Type) (f :: Char) = ThenVLChSym1 plCh prCh s0r f
type App (OrChSym plCh prCh s0r :: FunKind Char (OrS sl sr ~> PResult (OrS sl sr) (Either rl rr)) -> Type) (f :: Char) Source # 
Instance details

Defined in Symparsec.Parser.Or

type App (OrChSym plCh prCh s0r :: FunKind Char (OrS sl sr ~> PResult (OrS sl sr) (Either rl rr)) -> Type) (f :: Char) = OrChSym1 plCh prCh s0r f
type App NatBaseEndSym (mn :: Maybe Natural) Source # 
Instance details

Defined in Symparsec.Parser.Natural

type App TakeRestEndSym (chs :: [Char]) Source # 
Instance details

Defined in Symparsec.Parser.TakeRest

type App (TakeRestChSym1 ch :: FunKind [Char] (PResult [Char] Symbol) -> Type) (chs :: [Char]) Source # 
Instance details

Defined in Symparsec.Parser.TakeRest

type App (TakeRestChSym1 ch :: FunKind [Char] (PResult [Char] Symbol) -> Type) (chs :: [Char]) = 'Cont (ch ': chs) :: Result Symbol [Char] Symbol
type App (NatBaseChSym1 base parseDigit ch :: FunKind (Maybe Natural) (PResult (Maybe Natural) Natural) -> Type) (mn :: Maybe Natural) Source # 
Instance details

Defined in Symparsec.Parser.Natural

type App (NatBaseChSym1 base parseDigit ch :: FunKind (Maybe Natural) (PResult (Maybe Natural) Natural) -> Type) (mn :: Maybe Natural) = NatBaseCh base parseDigit ch mn
type App (FromEitherSym :: FunKind (Either a a) a -> Type) (eaa :: Either a a) Source # 
Instance details

Defined in Symparsec.Example.Expr

type App (FromEitherSym :: FunKind (Either a a) a -> Type) (eaa :: Either a a) = FromEither eaa
type App (Curry3Sym f :: FunKind ((a1, a2), a3) k -> Type) ('('(a4, b), c) :: ((a1, a2), a3)) Source # 
Instance details

Defined in Symparsec.Example.Expr

type App (Curry3Sym f :: FunKind ((a1, a2), a3) k -> Type) ('('(a4, b), c) :: ((a1, a2), a3)) = ((f @@ a4) @@ b) @@ c
type App (IsolateEndSym pEnd :: FunKind (Natural, s1) (PResultEnd r) -> Type) (s2 :: (Natural, s1)) Source # 
Instance details

Defined in Symparsec.Parser.Isolate

type App (IsolateEndSym pEnd :: FunKind (Natural, s1) (PResultEnd r) -> Type) (s2 :: (Natural, s1)) = IsolateEnd pEnd s2
type App (CountEndSym pEnd s0 :: FunKind (CountS a k) (PResultEnd [k]) -> Type) (s :: CountS a k) Source # 
Instance details

Defined in Symparsec.Parser.Count

type App (CountEndSym pEnd s0 :: FunKind (CountS a k) (PResultEnd [k]) -> Type) (s :: CountS a k) = CountEnd pEnd s0 s
type App (ThenVREndSym plEnd prEnd s0r :: FunKind (Either a1 (b1, a2)) (PResultEnd b1) -> Type) (s :: Either a1 (b1, a2)) Source # 
Instance details

Defined in Symparsec.Parser.Then.VoidRight

type App (ThenVREndSym plEnd prEnd s0r :: FunKind (Either a1 (b1, a2)) (PResultEnd b1) -> Type) (s :: Either a1 (b1, a2)) = ThenVREnd plEnd prEnd s0r s
type App (ThenEndSym plEnd prEnd s0r :: FunKind (Either a1 (k1, a2)) (PResultEnd (k1, k2)) -> Type) (s :: Either a1 (k1, a2)) Source # 
Instance details

Defined in Symparsec.Parser.Then

type App (ThenEndSym plEnd prEnd s0r :: FunKind (Either a1 (k1, a2)) (PResultEnd (k1, k2)) -> Type) (s :: Either a1 (k1, a2)) = ThenEnd plEnd prEnd s0r s
type App (ThenVLEndSym plEnd prEnd s0r :: FunKind (Either a1 a2) (PResultEnd b2) -> Type) (s :: Either a1 a2) Source # 
Instance details

Defined in Symparsec.Parser.Then.VoidLeft

type App (ThenVLEndSym plEnd prEnd s0r :: FunKind (Either a1 a2) (PResultEnd b2) -> Type) (s :: Either a1 a2) = ThenVLEnd plEnd prEnd s0r s
type App (OrEndSym plEnd prCh prEnd s0r :: FunKind (Either (sl, [Char]) sr) (PResultEnd (Either rl rr)) -> Type) (s :: Either (sl, [Char]) sr) Source # 
Instance details

Defined in Symparsec.Parser.Or

type App (OrEndSym plEnd prCh prEnd s0r :: FunKind (Either (sl, [Char]) sr) (PResultEnd (Either rl rr)) -> Type) (s :: Either (sl, [Char]) sr) = OrEnd plEnd prCh prEnd s0r s
type App (JoinSym :: FunKind (a ~> (a ~> b)) (a ~> b) -> Type) (f :: a ~> (a ~> b)) 
Instance details

Defined in DeFun.Function

type App (JoinSym :: FunKind (a ~> (a ~> b)) (a ~> b) -> Type) (f :: a ~> (a ~> b)) = JoinSym1 f
type App (ApSym :: FunKind (a ~> (b ~> c)) ((a ~> b) ~> (a ~> c)) -> Type) (f :: a ~> (b ~> c)) 
Instance details

Defined in DeFun.Function

type App (ApSym :: FunKind (a ~> (b ~> c)) ((a ~> b) ~> (a ~> c)) -> Type) (f :: a ~> (b ~> c)) = ApSym1 f
type App (FlipSym :: FunKind (a ~> (b ~> c)) (b ~> (a ~> c)) -> Type) (f :: a ~> (b ~> c)) 
Instance details

Defined in DeFun.Function

type App (FlipSym :: FunKind (a ~> (b ~> c)) (b ~> (a ~> c)) -> Type) (f :: a ~> (b ~> c)) = FlipSym1 f
type App (CompSym :: FunKind (b ~> c) ((a ~> b) ~> (a ~> c)) -> Type) (f :: b ~> c) 
Instance details

Defined in DeFun.Function

type App (CompSym :: FunKind (b ~> c) ((a ~> b) ~> (a ~> c)) -> Type) (f :: b ~> c) = CompSym1 f :: FunKind (a ~> b) (a ~> c) -> Type
type App (ApSym1 f :: FunKind (a ~> b) (a ~> c) -> Type) (g :: a ~> b) 
Instance details

Defined in DeFun.Function

type App (ApSym1 f :: FunKind (a ~> b) (a ~> c) -> Type) (g :: a ~> b) = ApSym2 f g
type App (CompSym1 f :: FunKind (a ~> b) (a ~> c) -> Type) (g :: a ~> b) 
Instance details

Defined in DeFun.Function

type App (CompSym1 f :: FunKind (a ~> b) (a ~> c) -> Type) (g :: a ~> b) = CompSym2 f g
type App (CountChSym1 pCh s0 ch :: FunKind (CountS k1 k2) (PResult (CountS k1 k2) [k2]) -> Type) (s :: CountS k1 k2) Source # 
Instance details

Defined in Symparsec.Parser.Count

type App (CountChSym1 pCh s0 ch :: FunKind (CountS k1 k2) (PResult (CountS k1 k2) [k2]) -> Type) (s :: CountS k1 k2) = CountCh pCh s0 ch s
type App (IsolateChSym1 pCh pEnd ch :: FunKind (Natural, s1) (PResult (Natural, s1) r) -> Type) (s2 :: (Natural, s1)) Source # 
Instance details

Defined in Symparsec.Parser.Isolate

type App (IsolateChSym1 pCh pEnd ch :: FunKind (Natural, s1) (PResult (Natural, s1) r) -> Type) (s2 :: (Natural, s1)) = IsolateCh pCh pEnd ch s2
type App (ThenChSym1 plCh prCh s0r ch :: FunKind (Either sl (rl, sr)) (PResult (Either sl (rl, sr)) (rl, rr)) -> Type) (s :: Either sl (rl, sr)) Source # 
Instance details

Defined in Symparsec.Parser.Then

type App (ThenChSym1 plCh prCh s0r ch :: FunKind (Either sl (rl, sr)) (PResult (Either sl (rl, sr)) (rl, rr)) -> Type) (s :: Either sl (rl, sr)) = ThenCh plCh prCh s0r ch s
type App (ThenVRChSym1 plCh prCh s0r ch :: FunKind (Either sl (rl, sr)) (PResult (Either sl (rl, sr)) rl) -> Type) (s :: Either sl (rl, sr)) Source # 
Instance details

Defined in Symparsec.Parser.Then.VoidRight

type App (ThenVRChSym1 plCh prCh s0r ch :: FunKind (Either sl (rl, sr)) (PResult (Either sl (rl, sr)) rl) -> Type) (s :: Either sl (rl, sr)) = ThenVRCh plCh prCh s0r ch s
type App (ThenVLChSym1 plCh prCh s0r ch :: FunKind (Either sl sr) (PResult (Either sl sr) rr) -> Type) (s :: Either sl sr) Source # 
Instance details

Defined in Symparsec.Parser.Then.VoidLeft

type App (ThenVLChSym1 plCh prCh s0r ch :: FunKind (Either sl sr) (PResult (Either sl sr) rr) -> Type) (s :: Either sl sr) = ThenVLCh plCh prCh s0r ch s
type App (OrChSym1 plCh prCh sr2 ch :: FunKind (OrS sl sr1) (PResult (OrS sl sr1) (Either rl rr)) -> Type) (s :: OrS sl sr1) Source # 
Instance details

Defined in Symparsec.Parser.Or

type App (OrChSym1 plCh prCh sr2 ch :: FunKind (OrS sl sr1) (PResult (OrS sl sr1) (Either rl rr)) -> Type) (s :: OrS sl sr1) = OrCh plCh prCh sr2 ch s

Common definitions

data FailChSym name e f Source #

Instances

Instances details
type App (FailChSym name e :: FunKind Char (s ~> PResult s r) -> Type) (f :: Char) Source # 
Instance details

Defined in Symparsec.Parser.Common

type App (FailChSym name e :: FunKind Char (s ~> PResult s r) -> Type) (f :: Char)

failChSym :: SSymbol name -> SDoc e -> SParserChSym ss sr (FailChSym name e) Source #

data FailEndSym name e s Source #

Fail with the given message if we're at the end of the symbol.

Instances

Instances details
type App (FailEndSym name e :: FunKind a (PResultEnd r) -> Type) (s :: a) Source # 
Instance details

Defined in Symparsec.Parser.Common

type App (FailEndSym name e :: FunKind a (PResultEnd r) -> Type) (s :: a) = 'Left ('EBase name e) :: Either (E Symbol) r

failEndSym :: SSymbol name -> SDoc e -> SParserEndSym ss sr (FailEndSym name e) Source #

type ErrParserLimitation msg = Text "parser limitation: " :<>: Text msg Source #

Helper for writing error messages to do with parser limitations (e.g. if you tried to use a non-consuming parser like Skip 0).