packages feed

derive-storable-plugin 0.1.0.0 → 0.1.0.1

raw patch · 3 files changed

+50/−5 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

ChangeLog.md view
@@ -1,5 +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,40 @@+# Introduction++The goal of `generic-storable-plugin` is to support the [generic-storable](https://www.github.com/mkloczko/generic-storable) package. It introduces optimisations to GStorable methods derived using GHC.Generics at core-to-core passes. ++# Usage++Just add a `-fplugin=Foreign.Storable.Generic.Plugin` flag and you're set. You might also want to pass a verbosity flag -vX, where X is either 0,1 or 2. By default the verbosity flag is set to `-v1`. +++```haskell+{-# LANGUAGE DeriveGeneric, DeriveAnyClass #-}+{-# OPTIONS_GHC -fplugin=Foreign.Storable.Generic.Plugin #-}+{-# OPTIONS_GHC -fplugin-opt=Foreign.Storable.Generic.Plugin:-v1 #-} +module Main where++import GHC.Generics++import Foreign.Storable.Generic+import Foreign.Ptr+import Foreign.Marshal.Alloc++data Point = Point {+    x :: Float,+    y :: Float+    } deriving (Show, Read, Generic, GStorable)++main = do+    let val = Point 0.0 10.0+    ptr <- malloc :: IO (Ptr Point)+    putStrLn "Created a ptr with value of"+    print =<< peek ptr+    poke ptr val+    putStrLn "And now the value of ptr is:"+    print =<< peek ptr+```++# Benchmarks++The plugin was benchmarked using [generic-storable-benchmark](https://www.github.com/mkloczko/generic-storable-benchmark/tree/plugin) package. The benchark measures handwritten Storable instances, raw GStorable instances and optimised-by-plugin GStorable instances. The code was compiled with `-O1` optimisation flag.+![Benchmarks](https://raw.githubusercontent.com/mkloczko/generic-storable-plugin/images/benchmarks/O1.png)
derive-storable-plugin.cabal view
@@ -2,10 +2,11 @@ -- further documentation, see http://haskell.org/cabal/users-guide/  name:                derive-storable-plugin-version:             0.1.0.0-synopsis:            GHC core plugin supporting the generic-storable package.--- description:         -homepage:            https://www.github.com/mkloczko/generic-storable-plugin/+version:             0.1.0.1+synopsis:            GHC core plugin supporting the derive-storable package.+description:         The package helps derive-storable package in forcing compile time evaluation of+                     sizes, alignments and offsets.+homepage:            https://www.github.com/mkloczko/derive-storable-plugin/ license:             MIT license-file:        LICENSE author:              Mateusz Kłoczko@@ -13,7 +14,7 @@ -- copyright:            category:            Foreign build-type:          Simple-extra-source-files:  ChangeLog.md+extra-source-files:  ChangeLog.md README.md cabal-version:       >=1.10  library