packages feed

derive-storable 0.1.0.0 → 0.1.0.1

raw patch · 3 files changed

+63/−39 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

+ ChangeLog.md view
@@ -0,0 +1,9 @@+# Revision history for generic-storable-plugin++## 0.1.0.1  -- 2016-09-11++* Added README.md to the package++## 0.1.0.0  -- 2016-09-08++* First version. Released on an unsuspecting world.
+ README.md view
@@ -0,0 +1,48 @@+# Introduction++The `generic-storable` package allows you to automatically generate Storable instances for your datatypes. It uses GHC.Generics, which allows the coders to derive certain instances automatically. To derive a (G)Storable instance, the data-type has to:++* have only one constructor.+* all fields of the constructor need to be GStorable.+* implement a Generic instance (`derive (Generic)`)++In order to achieve the same performance as for hand-written instances, take a look at [generic-storable-plugin](https://www.github.com/mkloczko/generic-storable-plugin).++# Usage++Here's an example:+++```haskell+{-# LANGUAGE DeriveGeneric #-}++import Foreign.Storable+import Foreign.Storable.Generic+import Foreign.Ptr+import Foreign.Marshal.Alloc++import Generics.Deriving++data Position = Position {+   x :: Double, +   y :: Double+} deriving (Show,Read, Generic)++instance GStorable Position++updatePosition :: Ptr Position -> Position -> IO ()+updatePosition ptr pos = poke ptr pos+++main = do+    let val = Position 0.0 10.0+    ptr <- malloc :: IO (Ptr Position)      +    putStrLn "Created a ptr with value of"+    putStrLn =<< show <$> peek ptr+    updatePosition ptr val+    putStrLn "And now the value of ptr is:"   +    putStrLn =<< show <$> peek ptr++```++
derive-storable.cabal view
@@ -1,66 +1,33 @@--- Initial derive-storable.cabal generated by cabal init.  For further --- documentation, see http://haskell.org/cabal/users-guide/---- The name of the package. name:                derive-storable --- The package version.  See the Haskell package versioning policy (PVP) --- for standards guiding when and how versions should be incremented.--- http://www.haskell.org/haskellwiki/Package_versioning_policy--- PVP summary:      +-+------- breaking API changes---                   | | +----- non-breaking API additions---                   | | | +--- code changes with no API change-version:             0.1.0.0---- A short (one-line) description of the package.-synopsis: Deriving Storable instances using generics.           +version:             0.1.0.1+synopsis: Derive Storable instances with help of GHC.Generics.            --- A longer description of the package.--- description:         +description:         The package allows for automatic derivation of Storable instances +                     with C-like memory layout. --- The license under which the package is released.+homepage:            https://www.github.com/mkloczko/derive-storable-plugin/ license:             MIT --- The file containing the license text. license-file:        LICENSE --- The package author(s). author:              Mateusz Kloczko --- An email address to which users can send suggestions, bug reports, and --- patches. maintainer:          mateusz.p.kloczko@gmail.com---- A copyright notice.--- copyright:           - category:            FFI  build-type:          Simple --- Extra files to be distributed with the package, such as examples or a --- README.--- extra-source-files:  +extra-source-files:  ChangeLog.md README.md --- Constraint on the version of Cabal needed to build this package. cabal-version:       >=1.10   library-  -- Modules exported by the library.   exposed-modules:     Foreign.Storable.Generic, Foreign.Storable.Generic.Tools                      , Foreign.Storable.Generic.Internal, Foreign.Storable.Generic.Instances       -  -  -- LANGUAGE extensions used by modules in this package.-  -- other-extensions:    -  -  -- Other library packages from which modules are imported.   build-depends:       base >=4.8 && <4.10-  -  -- Directories containing source files.   hs-source-dirs:      src-  -  -- Base language which the package is written in.   default-language:    Haskell2010