peek -package:base
View the next value in the stream without consuming it.
Look at the next value in the stream, if available. This function will
not change the state of the stream.
Since 0.3.0
Read a value from the given memory location.
Note that the peek and poke functions might require properly aligned
addresses to function correctly. This is architecture dependent; thus,
portable code should ensure that when peeking or poking values of some
type
a, the alignment constraint for
a, as given by
the function
alignment is fulfilled.
Peek at what the current focus would be for a different stored value
Peek satisfies the law
peek x . extend (peek y) = peek y
peek checks the first element of the stream, but uses
unDraw to push the element back so that it is available for the
next
draw command.
peek = do
x <- draw
case x of
Nothing -> return ()
Just a -> unDraw a
return x
peek skeleton ptr fills the
skeleton with data read
from memory beginning at
ptr. The skeleton is needed formally
for using
Traversable. For instance when reading a list, it is
not clear, how many elements shall be read. Using the skeleton you can
give this information and you also provide information that is not
contained in the element type
a. For example you can call
peek (replicate 10 ()) ptr
for reading 10 elements from memory starting at
ptr.
Peek at the next value in the input stream without consuming it
Serialized a value from bytes, throwing exceptions if it encounters
invalid data or runs out of input bytes.
Serialized a value from bytes, throwing exceptions if it encounters
invalid data or runs out of input bytes.
Read a
Vector from a contiguous piece of memory.
Match any byte, to perform lookahead. Returns
Nothing if end of
input has been reached. Does not consume any input.
Note: Because this parser does not fail, do not use it with
combinators such as
many, because such as
many,
because such parsers loop until a failure occurs. Careless use will
thus result in an infinite loop.
Examine the next byte without consuming it, interpret it as an
ASCII-encoded character. This fails if the byte is above 0x7F
or if the end of input has been reached.
Match any character, to perform lookahead. Returns
Nothing if
end of input has been reached. Does not consume any input.
Note: Because this parser does not fail, do not use it with
combinators such as
many, because such as
many,
because such parsers loop until a failure occurs. Careless use will
thus result in an infinite loop.
Peek the head element of a stream, without consuming it. Fails if it
encounters end of input.
>>> Stream.parse ((,) <$> Parser.peek <*> Parser.satisfy (> 0)) $ Stream.fromList [1]
Right (1,1)
peek = lookAhead (satisfy True)
peek the first element from the input source without consuming it
Returns
Nothing if there is no more input to parse.
Read the state via an accessor function
O(1). Extract the focused element of the current stack. Return
Just that element, or
Nothing for an empty stack.