ptr-0.16.2: Abstractions for operations on pointers

Safe HaskellNone
LanguageHaskell2010

Ptr.Parse

Synopsis

Documentation

newtype Parse output Source #

Constructors

Parse (Int -> Ptr Word8 -> forall result. (Int -> IO result) -> (Text -> IO result) -> (output -> Int -> Ptr Word8 -> IO result) -> IO result) 

Instances

Monad Parse Source # 

Methods

(>>=) :: Parse a -> (a -> Parse b) -> Parse b #

(>>) :: Parse a -> Parse b -> Parse b #

return :: a -> Parse a #

fail :: String -> Parse a #

Functor Parse Source # 

Methods

fmap :: (a -> b) -> Parse a -> Parse b #

(<$) :: a -> Parse b -> Parse a #

Applicative Parse Source # 

Methods

pure :: a -> Parse a #

(<*>) :: Parse (a -> b) -> Parse a -> Parse b #

(*>) :: Parse a -> Parse b -> Parse b #

(<*) :: Parse a -> Parse b -> Parse a #

MonadIO Parse Source # 

Methods

liftIO :: IO a -> Parse a #

Alternative Parse Source # 

Methods

empty :: Parse a #

(<|>) :: Parse a -> Parse a -> Parse a #

some :: Parse a -> Parse [a] #

many :: Parse a -> Parse [a] #

MonadPlus Parse Source # 

Methods

mzero :: Parse a #

mplus :: Parse a -> Parse a -> Parse a #

fail :: Text -> Parse output Source #

io :: Int -> (Ptr Word8 -> IO output) -> Parse output Source #

mapInIO :: (output -> IO newOutput) -> Parse output -> Parse newOutput Source #

pokeAndPeek :: PokeAndPeek input output -> Parse output Source #

limiting :: Int -> Parse output -> Parse output Source #

peekRemainders :: Parse ByteString Source #

Decode the remaining bytes, whithout moving the parser's cursor. Useful for debugging.

foldWhile :: (Word8 -> Bool) -> (state -> Word8 -> state) -> state -> Parse state Source #

unsignedASCIIIntegral :: Integral a => Parse a Source #

Unsigned integral number encoded in ASCII.