storable-record 0.0.5 → 0.0.7
raw patch · 2 files changed
Files
src/Foreign/Storable/Record/Tuple.hs view
@@ -16,11 +16,23 @@ import qualified Control.Applicative.HT as App import Data.Tuple.HT (fst3, snd3, thd3) +import qualified Test.QuickCheck as QC + newtype Tuple a = Tuple {getTuple :: a} deriving (Eq, Show) ++instance (QC.Arbitrary a) => QC.Arbitrary (Tuple a) where+ arbitrary = fmap Tuple QC.arbitrary+ shrink (Tuple a) = map Tuple $ QC.shrink a++ instance Storable a => Store.Storable (Tuple a) where+ {-# INLINABLE sizeOf #-}+ {-# INLINABLE alignment #-}+ {-# INLINABLE peek #-}+ {-# INLINABLE poke #-} sizeOf = sizeOf . getTuple alignment = alignment . getTuple peek = fmap Tuple . peek . castPtr@@ -34,6 +46,10 @@ poke :: Ptr a -> a -> IO () instance (Store.Storable a, Store.Storable b) => Storable (a,b) where+ {-# INLINABLE sizeOf #-}+ {-# INLINABLE alignment #-}+ {-# INLINABLE peek #-}+ {-# INLINABLE poke #-} sizeOf = Record.sizeOf storePair alignment = Record.alignment storePair peek = Record.peek storePair@@ -53,6 +69,10 @@ instance (Store.Storable a, Store.Storable b, Store.Storable c) => Storable (a,b,c) where+ {-# INLINABLE sizeOf #-}+ {-# INLINABLE alignment #-}+ {-# INLINABLE peek #-}+ {-# INLINABLE poke #-} sizeOf = Record.sizeOf storeTriple alignment = Record.alignment storeTriple peek = Record.peek storeTriple@@ -72,6 +92,10 @@ instance (Store.Storable a, Store.Storable b, Store.Storable c, Store.Storable d) => Storable (a,b,c,d) where+ {-# INLINABLE sizeOf #-}+ {-# INLINABLE alignment #-}+ {-# INLINABLE peek #-}+ {-# INLINABLE poke #-} sizeOf = Record.sizeOf storeQuadruple alignment = Record.alignment storeQuadruple peek = Record.peek storeQuadruple
storable-record.cabal view
@@ -1,5 +1,6 @@+Cabal-Version: 2.2 Name: storable-record-Version: 0.0.5+Version: 0.0.7 Category: Data, Foreign Synopsis: Elegant definition of Storable instances for records Description:@@ -46,7 +47,7 @@ but we have still to investigate the problem. . For examples see packages @storable-tuple@ and @sample-frame@.-License: BSD3+License: BSD-3-Clause License-file: LICENSE Author: Henning Thielemann <storable@henning-thielemann.de> Maintainer: Henning Thielemann <storable@henning-thielemann.de>@@ -54,7 +55,6 @@ Stability: Experimental Build-Type: Simple Tested-With: GHC==6.8.2, GHC==6.10.4, GHC==6.12.1, GHC==8.0.1-Cabal-Version: >=1.6 Source-Repository head Type: darcs@@ -63,7 +63,7 @@ Source-Repository this Type: darcs Location: http://code.haskell.org/~thielema/storable-record/- Tag: 0.0.5+ Tag: 0.0.7 Flag splitBase description: Choose the new smaller, split-up base package.@@ -74,7 +74,8 @@ Library Build-Depends:- transformers >=0.2 && <0.6,+ QuickCheck >=2 && <3,+ transformers >=0.2 && <0.7, semigroups >=0.1 && <1.0, utility-ht >=0.0.14 && <0.1 If flag(splitBase)@@ -85,6 +86,7 @@ special-functors >= 1.0 && <1.1, base >= 1.0 && < 2 + Default-Language: Haskell98 GHC-Options: -Wall Hs-Source-Dirs: src @@ -107,6 +109,7 @@ Else Buildable: False + Default-Language: Haskell98 GHC-Options: -Wall Hs-Source-Dirs: src Main-Is: SpeedTest.hs