Foreign.Storable.Newtype

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

Safe Haskell | Safe-Inferred
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 #

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

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

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