module Text.ParserCombinators.Poly.State
(
Parser(P)
, Result(..)
, runParser
, next
, eof
, satisfy
, onFail
, stUpdate
, stQuery
, stGet
, reparse
, module Text.ParserCombinators.Poly.Base
, module Control.Applicative
) where
import Text.ParserCombinators.Poly.Base
import Text.ParserCombinators.Poly.Result
import Text.ParserCombinators.Poly.StateParser
import Control.Applicative
runParser :: Parser s t a -> s -> [t] -> (Either String a, s, [t])
runParser :: forall s t a. Parser s t a -> s -> [t] -> (Either String a, s, [t])
runParser (P s -> [t] -> Result ([t], s) a
p) = \s
s-> forall {a} {c} {b}. (a, (c, b)) -> (a, b, c)
reTuple forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall z a. Result z a -> (Either String a, z)
resultToEither forall b c a. (b -> c) -> (a -> b) -> a -> c
. s -> [t] -> Result ([t], s) a
p s
s
where
reTuple :: (a, (c, b)) -> (a, b, c)
reTuple (a
either, (c
z,b
s)) = (a
either, b
s, c
z)