Popularity
5.5
Declining
Activity
0.0
Stable
10
3
3

Monthly Downloads: 24
Programming language: Haskell
License: BSD 3-clause "New" or "Revised" License
Tags: Foreign    

c-storable-deriving alternatives and similar packages

Based on the "Foreign" category.
Alternatively, view c-storable-deriving alternatives based on common mentions on social networks and blogs.

Do you think we are missing an alternative of c-storable-deriving or a related project?

Add another 'Foreign' Package

README

c-storable-deriving

This library is intended to make generating C-like storable instances from datatypes easy.

Example

{-# LANGUAGE DeriveGeneric, DeriveAnyClass #-}

import GHC.Generics (Generic(..))
import Foreign (Storable(..))
import Foreign.CStorable (CStorable(..))

-- | a two-dimensional point.
-- Compatible with both OSX's @CGPoint@ and Window's @POINT@.
data Point = Point
 { x :: Double
 , y :: Double
 } deriving (Generic, CStorable)

instance Storable Point where
 peek      = cPeek
 poke      = cPoke
 alignment = cAlignment
 sizeOf    = cSizeOf

See the haddocks for further details: Foreign.CStorable