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

Foreign.Storable.Newtype

Description

Storable instances for simple wrapped types.

Example:

 import 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 -> IntSource

alignment :: Storable core => (wrapper -> core) -> wrapper -> IntSource

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

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