Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Symparsec.Parser.Isolate
Synopsis
- type family Isolate n p where ...
- type Isolate' n pCh pEnd s0 = 'PParser (IsolateChSym pCh pEnd) (IsolateEndSym pEnd) '(n, s0)
- type SIsolateS ss = STuple2 SNat ss
- sIsolate :: SNat n -> SParser ss sr p -> SParser (SIsolateS ss) sr (Isolate n p)
- type family IsolateCh pCh pEnd ch s where ...
- sIsolateChSym :: SParserChSym ss sr pCh -> SParserEndSym ss sr pEnd -> SParserChSym (SIsolateS ss) sr (IsolateChSym pCh pEnd)
- type family IsolateInnerEnd a where ...
- type family IsolateInner n res where ...
- sIsolateInner :: SNat n -> SResult ss sr res -> SResult (SIsolateS ss) sr (IsolateInner n res)
- type family IsolateEnd pEnd s where ...
- sIsolateEndSym :: SParserEndSym ss sr pEnd -> SParserEndSym (SIsolateS ss) sr (IsolateEndSym pEnd)
- type family IsolateEnd' res where ...
- sIsolateEnd' :: SResultEnd sr res -> SResultEnd sr (IsolateEnd' res)
- data IsolateEndSym pEnd s
- data IsolateChSym pCh pEnd f
- data IsolateChSym1 pCh pEnd ch s
- type EIsolateWrap e = EIn "Isolate" e
- eIsolateWrap :: SE e -> SE (EIsolateWrap e)
- type EIsolateEndN n = EBase "Isolate" ((Text "tried to isolate more than present (needed " :<>: Text (ShowNatDec n)) :<>: Text " more)")
- eIsolateEndN :: SNat n -> SE (EIsolateEndN n)
- type EIsolateRemaining n = EBase "Isolate" ((Text "isolated parser ended without consuming all input (" :<>: Text (ShowNatDec n)) :<>: Text " remaining)")
- eIsolateRemaining :: SNat n -> SE (EIsolateRemaining n)
Documentation
type family Isolate n p where ... Source #
Run the given parser isolated to the next n
characters.
All isolated characters must be consumed.
type Isolate' n pCh pEnd s0 = 'PParser (IsolateChSym pCh pEnd) (IsolateEndSym pEnd) '(n, s0) 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 #
Equations
IsolateInnerEnd (Right r) = Done r | |
IsolateInnerEnd (Left e) = Err (EIsolateWrap e) |
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) |
sIsolateEndSym :: SParserEndSym ss sr pEnd -> SParserEndSym (SIsolateS ss) sr (IsolateEndSym pEnd) Source #
type family IsolateEnd' res where ... Source #
Equations
IsolateEnd' (Right r) = Right r | |
IsolateEnd' (Left e) = Left (EIsolateWrap e) |
sIsolateEnd' :: SResultEnd sr res -> SResultEnd sr (IsolateEnd' res) Source #
data IsolateEndSym pEnd s Source #
Instances
(p ~ 'PParser pCh pEnd s0, KnownNat n, SingParser p) => SingParser (Isolate' n pCh pEnd s0 :: PParser (Natural, s) r) Source # | |
type PS (Isolate' n pCh pEnd s0 :: PParser (Natural, s) r) Source # | |
type PR (Isolate' n pCh pEnd s0 :: PParser (Natural, s) r) Source # | |
type App (IsolateEndSym pEnd :: FunKind (Natural, s1) (PResultEnd r) -> Type) (s2 :: (Natural, s1)) Source # | |
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
(p ~ 'PParser pCh pEnd s0, KnownNat n, SingParser p) => SingParser (Isolate' n pCh pEnd s0 :: PParser (Natural, s) r) Source # | |
type App (IsolateChSym pCh pEnd :: FunKind Char ((Natural, s) ~> PResult (Natural, s) r) -> Type) (f :: Char) Source # | |
Defined in Symparsec.Parser.Isolate | |
type PS (Isolate' n pCh pEnd s0 :: PParser (Natural, s) r) Source # | |
type PR (Isolate' n pCh pEnd s0 :: PParser (Natural, s) r) Source # | |
data IsolateChSym1 pCh pEnd ch s Source #
type EIsolateWrap e = EIn "Isolate" e Source #
eIsolateWrap :: SE e -> SE (EIsolateWrap e) Source #
type EIsolateEndN n = EBase "Isolate" ((Text "tried to isolate more than present (needed " :<>: Text (ShowNatDec n)) :<>: Text " more)") Source #
eIsolateEndN :: SNat n -> SE (EIsolateEndN n) Source #
type EIsolateRemaining n = EBase "Isolate" ((Text "isolated parser ended without consuming all input (" :<>: Text (ShowNatDec n)) :<>: Text " remaining)") Source #
eIsolateRemaining :: SNat n -> SE (EIsolateRemaining n) Source #