parsnip-0: A fast, minimal parser
Safe HaskellNone
LanguageHaskell2010

Text.Parsnip.Internal.Parser

Synopsis

Parser

newtype Parser s a Source #

Constructors

Parser 

Fields

Instances

Instances details
Monad (Parser s) Source # 
Instance details

Defined in Text.Parsnip.Internal.Parser

Methods

(>>=) :: Parser s a -> (a -> Parser s b) -> Parser s b #

(>>) :: Parser s a -> Parser s b -> Parser s b #

return :: a -> Parser s a #

Functor (Parser s) Source # 
Instance details

Defined in Text.Parsnip.Internal.Parser

Methods

fmap :: (a -> b) -> Parser s a -> Parser s b #

(<$) :: a -> Parser s b -> Parser s a #

Applicative (Parser s) Source # 
Instance details

Defined in Text.Parsnip.Internal.Parser

Methods

pure :: a -> Parser s a #

(<*>) :: Parser s (a -> b) -> Parser s a -> Parser s b #

liftA2 :: (a -> b -> c) -> Parser s a -> Parser s b -> Parser s c #

(*>) :: Parser s a -> Parser s b -> Parser s b #

(<*) :: Parser s a -> Parser s b -> Parser s a #

Alternative (Parser s) Source # 
Instance details

Defined in Text.Parsnip.Internal.Parser

Methods

empty :: Parser s a #

(<|>) :: Parser s a -> Parser s a -> Parser s a #

some :: Parser s a -> Parser s [a] #

many :: Parser s a -> Parser s [a] #

MonadPlus (Parser s) Source # 
Instance details

Defined in Text.Parsnip.Internal.Parser

Methods

mzero :: Parser s a #

mplus :: Parser s a -> Parser s a -> Parser s a #

PrimMonad (Parser s) Source # 
Instance details

Defined in Text.Parsnip.Internal.Parser

Associated Types

type PrimState (Parser s)

Methods

primitive :: (State# (PrimState (Parser s)) -> (# State# (PrimState (Parser s)), a #)) -> Parser s a

a ~ ByteString => IsString (Parser s a) Source # 
Instance details

Defined in Text.Parsnip.Internal.Parser

Methods

fromString :: String -> Parser s a #

type PrimState (Parser s) Source # 
Instance details

Defined in Text.Parsnip.Internal.Parser

type PrimState (Parser s) = s

newtype Option a Source #

Unlifted Maybe

Constructors

Option# (# a | (# #) #) 

Bundled Patterns

pattern Some :: a -> Option a 
pattern None :: Option a 

mapOption :: (a -> b) -> Option a -> Option b Source #

setOption :: b -> Option a -> Option b Source #

type Result s a = (# Option a, Addr#, State# s #) Source #

pattern OK :: a -> Addr# -> State# s -> Result s a Source #

pattern Fail :: Addr# -> State# s -> Result s a Source #

mapResult :: (a -> b) -> Result s a -> Result s b Source #

setResult :: b -> Result s a -> Result s b Source #

try :: Parser s a -> Parser s a Source #

Unsafe literals

lit :: Addr# -> Parser s ByteString Source #

Super unsafe. Fabricates a bytestring that directly reference constant memory.

Usage:

hello = lit "hello"#

litN :: Addr# -> CSize -> Parser s ByteString Source #

super-duper unsafe. Fabricates bytestrings that directly reference constant memory

Guts

bytes :: forall s. KnownBase s => ByteString Source #

start :: forall s. KnownBase s => Addr# Source #

end :: forall s. KnownBase s => Addr# Source #

class KnownBase (s :: Type) where Source #

Methods

reflectBase :: Base s Source #

parse :: (forall s. KnownBase s => Parser s a) -> ByteString -> Either Location a Source #