peek package:ghc-internal
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.
Marshal a NUL terminated C string into a Haskell string.
Marshal a C string with explicit length into a Haskell string.
Marshal a NUL terminated C string into a Haskell string.
Marshal a C string with explicit length into a Haskell string.
Marshal a NUL terminated C wide string into a Haskell string.
Marshal a C wide string with explicit length into a Haskell string.
Marshal a NUL terminated C string into a Haskell string.
Marshal a C string with explicit length into a Haskell string.
Convert an array of given length into a Haskell list. The
implementation is tail-recursive and so uses constant stack space.
Convert an array terminated by the given end marker into a Haskell
list
Read a value from a memory location given by a base address and
offset. The following equality holds:
peekByteOff addr off = peek (addr `plusPtr` off)
Read a value from a memory area regarded as an array of values of the
same kind. The first argument specifies the start address of the array
and the second the index into the array (the first element of the
array has index
0). The following equality holds,
peekElemOff addr idx = IOExts.fixIO $ \result ->
peek (addr `plusPtr` (idx * sizeOf result))
Note that this is only a specification, not necessarily the concrete
implementation of the function.
Convert a peek combinator into a one returning
Nothing if
applied to a
nullPtr