storable-record-0.0.5: Elegant definition of Storable instances for records

Safe Haskell | Safe
Language | Haskell98

Foreign.Storable.Newtype

Description

Storable instances for simple wrapped types.

Example:

    import qualified Foreign.Storable.Newtype as Store

    newtype MuLaw = MuLaw {deMuLaw :: Word8}

    instance Storable MuLaw where
       sizeOf = Store.sizeOf deMuLaw
       alignment = Store.alignment deMuLaw
       peek = Store.peek MuLaw
       poke = Store.poke deMuLaw

# Documentation

sizeOf :: Storable core => (wrapper -> core) -> wrapper -> Int Source #

alignment :: Storable core => (wrapper -> core) -> wrapper -> Int Source #

peek :: Storable core => (core -> wrapper) -> Ptr wrapper -> IO wrapper Source #

poke :: Storable core => (wrapper -> core) -> Ptr wrapper -> wrapper -> IO () Source #