derive-storable-plugin 0.2.1.0 → 0.2.2.0
raw patch · 3 files changed
+36/−15 lines, 3 filesdep ~basedep ~ghcdep ~ghciPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base, ghc, ghci
API changes (from Hackage documentation)
Files
- ChangeLog.md +4/−0
- derive-storable-plugin.cabal +13/−9
- src/Foreign/Storable/Generic/Plugin/Internal/Compile.hs +19/−6
ChangeLog.md view
@@ -1,5 +1,9 @@ # Revision history for generic-storable-plugin +## 0.2.2.0 -- 2018-09-29++* Bump to 8.6+ ## 0.2.1.0 -- 2018-03-20 * Bump to 8.4
derive-storable-plugin.cabal view
@@ -2,7 +2,7 @@ -- further documentation, see http://haskell.org/cabal/users-guide/ name: derive-storable-plugin-version: 0.2.1.0+version: 0.2.2.0 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.@@ -16,8 +16,12 @@ build-type: Simple extra-source-files: ChangeLog.md README.md cabal-version: >=1.10-tested-with: GHC==8.0.1, GHC==8.0.2, GHC==8.2.1, GHC==8.4.1+tested-with: GHC==8.0.1, GHC==8.0.2, GHC==8.2.1, GHC==8.4.1, GHC==8.6.1 +source-repository head+ type: git+ location: https://www.github.com/mkloczko/derive-storable-plugin/+ library exposed-modules: Foreign.Storable.Generic.Plugin , Foreign.Storable.Generic.Plugin.Internal@@ -29,7 +33,7 @@ , Foreign.Storable.Generic.Plugin.Internal.Types -- other-modules: other-extensions: DeriveGeneric, DeriveAnyClass, PatternGuards- build-depends: base >=4.9 && <4.12, ghc >= 8.0 && <8.5, ghci >= 8.0 && <8.5, derive-storable >= 0.1.1 && < 0.2+ build-depends: base >=4.9 && <4.13, ghc >= 8.0 && <8.7, ghci >= 8.0 && <8.7, derive-storable >= 0.1.1 && < 0.2 hs-source-dirs: src default-language: Haskell2010 @@ -39,7 +43,7 @@ default-language: Haskell2010 other-modules: TestCases, TestCasesOptimized Main-is: Main.hs- build-depends: base >= 4.9 && < 4.12, deepseq, criterion >= 1.1.0+ build-depends: base >= 4.9 && < 4.13, deepseq, criterion >= 1.1.0 , derive-storable, derive-storable-plugin test-suite ids-concrete type: exitcode-stdio-1.0@@ -47,7 +51,7 @@ default-language: Haskell2010 other-modules: Types, Instances Main-is: Main.hs- build-depends: base >= 4.9 && < 4.12, ghc >= 8.0 && <8.5, ghci >= 8.0 && <8.5, ghc-paths+ build-depends: base >= 4.9 && < 4.13, ghc >= 8.0 && <8.7, ghci >= 8.0 && <8.7, ghc-paths , derive-storable, derive-storable-plugin, hspec >= 2.4, QuickCheck >= 2.10 test-suite ids-handwritten@@ -56,7 +60,7 @@ default-language: Haskell2010 other-modules: Types, Instances Main-is: Main.hs- build-depends: base >= 4.9 && < 4.12, ghc >= 8.0 && <8.5, ghci >= 8.0 && <8.5, ghc-paths+ build-depends: base >= 4.9 && < 4.13, ghc >= 8.0 && <8.7, ghci >= 8.0 && <8.7, ghc-paths , derive-storable, derive-storable-plugin, hspec >= 2.4, QuickCheck >= 2.10 test-suite ids-newtype@@ -65,7 +69,7 @@ default-language: Haskell2010 other-modules: Types, Instances Main-is: Main.hs- build-depends: base >= 4.9 && < 4.12, ghc >= 8.0 && <8.5, ghci >= 8.0 && <8.5, ghc-paths+ build-depends: base >= 4.9 && < 4.13, ghc >= 8.0 && <8.7, ghci >= 8.0 && <8.7, ghc-paths , derive-storable, derive-storable-plugin, hspec >= 2.4, QuickCheck >= 2.10 test-suite ids-parametrised-spec@@ -74,7 +78,7 @@ default-language: Haskell2010 other-modules: Types, Instances, Usage Main-is: Main.hs- build-depends: base >= 4.9 && < 4.12, ghc >= 8.0 && <8.5, ghci >= 8.0 && <8.5, ghc-paths+ build-depends: base >= 4.9 && < 4.13, ghc >= 8.0 && <8.7, ghci >= 8.0 && <8.7, ghc-paths , derive-storable, derive-storable-plugin, hspec >= 2.4, QuickCheck >= 2.10 test-suite ids-typesynonym@@ -83,5 +87,5 @@ default-language: Haskell2010 other-modules: Types, Instances Main-is: Main.hs- build-depends: base >= 4.9 && < 4.12, ghc >= 8.0 && <8.5, ghci >= 8.0 && <8.5, ghc-paths+ build-depends: base >= 4.9 && < 4.13, ghc >= 8.0 && <8.7, ghci >= 8.0 && <8.7, ghc-paths , derive-storable, derive-storable-plugin, hspec >= 2.4, QuickCheck >= 2.10
src/Foreign/Storable/Generic/Plugin/Internal/Compile.hs view
@@ -9,6 +9,7 @@ The core of compile and substitute optimisations. -}+{-#LANGUAGE CPP#-} module Foreign.Storable.Generic.Plugin.Internal.Compile ( -- Compilation@@ -42,6 +43,9 @@ import Prelude hiding ((<>)) import CoreSyn (Bind(..),Expr(..), CoreExpr, CoreBind, CoreProgram, Alt, AltCon(..), isId, Unfolding(..)) import Literal (Literal(..))+#if MIN_VERSION_GLASGOW_HASKELL(8,6,0,0)+import Literal (LitNumType(..))+#endif import Id (isLocalId, isGlobalId,setIdInfo,Id) import IdInfo (IdInfo(..)) import Var (Var(..), idInfo)@@ -59,8 +63,9 @@ -- Haskell types import Type (isAlgType, splitTyConApp_maybe) import TyCon (tyConName, algTyConRhs, visibleDataCons)-import TyCoRep (Type(..), TyBinder(..))-import TysWiredIn (intDataCon)+import TyCoRep (Type(..), TyBinder(..), TyLit(..))+import TysWiredIn+import TysPrim (intPrimTy) import DataCon (dataConWorkId,dataConOrigArgTys) import MkCore (mkWildValBinder)@@ -73,7 +78,6 @@ import GHCi.RemoteTypes -- Used to create types-import TysWiredIn import PrelNames (buildIdKey, augmentIdKey) import DataCon (dataConWorkId) import BasicTypes (Boxity(..))@@ -122,11 +126,20 @@ -- Int substitution -- ---------------------- +-- | A small helper - create an integer literal.+intLiteral :: (Integral a) => a -> CoreExpr+#if MIN_VERSION_GLASGOW_HASKELL(8,6,0,0)+intLiteral i = Lit $ LitNumber LitNumInt (fromIntegral i) intPrimTy+#else+intLiteral i = Lit $ MachInt $ fromIntegral i+#endif+ -- | Create an expression of form: \x -> 16 intToExpr :: Type -> Int -> CoreExpr intToExpr t i = Lam wild $ App fun arg where fun = Var $ dataConWorkId intDataCon- arg = Lit $ MachInt $ fromIntegral i+ -- arg = Lit $ MachInt $ fromIntegral i+ arg = intLiteral i wild= mkWildValBinder t -- | For gsizeOf and galignment - calculate the variables.@@ -197,7 +210,7 @@ intListExpr' [] acc = acc intListExpr' (l:ls) acc = intListExpr' ls $ App int_cons acc where int_t_cons = App (Var $ dataConWorkId consDataCon) (Type intTy) - int_val = App (Var $ dataConWorkId intDataCon ) (Lit $ MachInt $ fromIntegral l) + int_val = App (Var $ dataConWorkId intDataCon ) (intLiteral l) int_cons = App int_t_cons int_val -- | Compile expression to list and then write it back to core expr.@@ -209,7 +222,7 @@ -- | Create a int prim expression. intPrimValExpr :: Int -> CoreExpr-intPrimValExpr i = Lit $ MachInt $ fromIntegral i +intPrimValExpr i = intLiteral i -- | Compile expression to int prim and then write it back to core expr. exprToIntVal :: Id -> CoreExpr -> CoreM (Either Error OffsetScope)