symparsec-1.0.0: 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 #

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 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 (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 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 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 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 (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 (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 (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 NatBaseEndSym (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) 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 (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 (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 (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

Common definitions

data FailChSym name e f Source #

Fail with the given message when given any character to parse.

Instances

Instances details
SingParser End Source # 
Instance details

Defined in Symparsec.Parser.End

Associated Types

type PS End :: s -> Type Source #

type PR End :: r -> Type Source #

type PR End Source # 
Instance details

Defined in Symparsec.Parser.End

type PR End = SUnit
type PS End Source # 
Instance details

Defined in Symparsec.Parser.End

type PS End = SUnit
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).