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

Symparsec.Parser.Isolate

Synopsis

Documentation

type family Isolate n p where ... Source #

Run the given parser isolated to the next n characters.

All isolated characters must be consumed.

Equations

Isolate n ('PParser pCh pEnd s0) = Isolate' n pCh pEnd s0 

type Isolate' n pCh pEnd s0 = 'PParser (IsolateChSym pCh pEnd) (IsolateEndSym pEnd) '(n, s0) Source #

sIsolate :: SNat n -> SParser ss sr p -> SParser (SIsolateS ss) sr (Isolate n p) Source #

type family IsolateCh pCh pEnd ch s where ... Source #

Equations

IsolateCh pCh pEnd ch '(0, s) = IsolateInnerEnd (pEnd @@ s) 
IsolateCh pCh pEnd ch '(n, s) = IsolateInner n ((pCh @@ ch) @@ s) 

sIsolateChSym :: SParserChSym ss sr pCh -> SParserEndSym ss sr pEnd -> SParserChSym (SIsolateS ss) sr (IsolateChSym pCh pEnd) Source #

type family IsolateInnerEnd a where ... Source #

type family IsolateInner n res where ... Source #

Equations

IsolateInner n (Cont s) = Cont '(n - 1, s) 
IsolateInner n (Done _) = Err (EIsolateRemaining n) 
IsolateInner _ (Err e) = Err (EIsolateWrap e) 

sIsolateInner :: SNat n -> SResult ss sr res -> SResult (SIsolateS ss) sr (IsolateInner n res) Source #

type family IsolateEnd pEnd s where ... Source #

Equations

IsolateEnd pEnd '(0, s) = IsolateEnd' (pEnd @@ s) 
IsolateEnd pEnd '(n, s) = Left (EIsolateEndN n) 

type family IsolateEnd' res where ... Source #

Equations

IsolateEnd' (Right r) = Right r 
IsolateEnd' (Left e) = Left (EIsolateWrap e) 

data IsolateEndSym pEnd s Source #

Instances

Instances details
(p ~ 'PParser pCh pEnd s0, KnownNat n, SingParser p) => SingParser (Isolate' n pCh pEnd s0 :: PParser (Natural, s) r) Source # 
Instance details

Defined in Symparsec.Parser.Isolate

Associated Types

type PS (Isolate' n pCh pEnd s0) :: s -> Type Source #

type PR (Isolate' n pCh pEnd s0) :: r -> Type Source #

Methods

singParser' :: SParser (PS (Isolate' n pCh pEnd s0)) (PR (Isolate' n pCh pEnd s0)) (Isolate' n pCh pEnd s0) Source #

type PS (Isolate' n pCh pEnd s0 :: PParser (Natural, s) r) Source # 
Instance details

Defined in Symparsec.Parser.Isolate

type PS (Isolate' n pCh pEnd s0 :: PParser (Natural, s) r) = SIsolateS (PS ('PParser pCh pEnd s0))
type PR (Isolate' n pCh pEnd s0 :: PParser (Natural, s) r) Source # 
Instance details

Defined in Symparsec.Parser.Isolate

type PR (Isolate' n pCh pEnd s0 :: PParser (Natural, s) r) = PR ('PParser pCh pEnd s0)
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

data IsolateChSym pCh pEnd f Source #

Instances

Instances details
(p ~ 'PParser pCh pEnd s0, KnownNat n, SingParser p) => SingParser (Isolate' n pCh pEnd s0 :: PParser (Natural, s) r) Source # 
Instance details

Defined in Symparsec.Parser.Isolate

Associated Types

type PS (Isolate' n pCh pEnd s0) :: s -> Type Source #

type PR (Isolate' n pCh pEnd s0) :: r -> Type Source #

Methods

singParser' :: SParser (PS (Isolate' n pCh pEnd s0)) (PR (Isolate' n pCh pEnd s0)) (Isolate' n pCh pEnd s0) Source #

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 PS (Isolate' n pCh pEnd s0 :: PParser (Natural, s) r) Source # 
Instance details

Defined in Symparsec.Parser.Isolate

type PS (Isolate' n pCh pEnd s0 :: PParser (Natural, s) r) = SIsolateS (PS ('PParser pCh pEnd s0))
type PR (Isolate' n pCh pEnd s0 :: PParser (Natural, s) r) Source # 
Instance details

Defined in Symparsec.Parser.Isolate

type PR (Isolate' n pCh pEnd s0 :: PParser (Natural, s) r) = PR ('PParser pCh pEnd s0)

data IsolateChSym1 pCh pEnd ch s Source #

Instances

Instances details
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 EIsolateWrap e = EIn "Isolate" e Source #

type EIsolateEndN n = EBase "Isolate" ((Text "tried to isolate more than present (needed " :<>: Text (ShowNatDec n)) :<>: Text " more)") Source #

type EIsolateRemaining n = EBase "Isolate" ((Text "isolated parser ended without consuming all input (" :<>: Text (ShowNatDec n)) :<>: Text " remaining)") Source #