ptr-0.16.2: Abstractions for operations on pointers

Safe HaskellNone
LanguageHaskell2010

Ptr.Peek

Synopsis

Documentation

data Peek output Source #

Constructors

Peek !Int !(Ptr Word8 -> IO output) 

Instances

Functor Peek Source # 

Methods

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

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

Applicative Peek Source # 

Methods

pure :: a -> Peek a #

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

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

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

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

parse :: Int -> Parse a -> (Int -> a) -> (Text -> a) -> Peek a Source #

Given the length of the data and a specification of its sequential consumption, produces Peek, which results in Just the successfully taken value, or Nothing, if the specified length of data wasn't enough.

parseUnbound :: Int -> ParseUnbound a -> (Int -> a) -> (Text -> a) -> Peek a Source #

Given the length of the data and a specification of its sequential consumption, produces Peek, which results in Just the successfully taken value, or Nothing, if the specified length of data wasn't enough.

peekAmountAndParse :: Peek Int -> Parse a -> (Int -> a) -> (Text -> a) -> Peek (Peek a) Source #

A standard idiom, where a header specifies the length of the body.

Produces Peek, which itself produces another Peek, which is the same as the result of the parse function.