souffle-haskell 0.2.1 → 0.2.2
raw patch · 4 files changed
+76/−3 lines, 4 files
Files
- CHANGELOG.md +6/−0
- lib/Language/Souffle/Internal/Constraints.hs +1/−1
- souffle-haskell.cabal +3/−2
- tests/Test/Language/Souffle/MarshalSpec.hs +66/−0
CHANGELOG.md view
@@ -4,6 +4,12 @@ All notable changes to this project (as seen by library users) will be documented in this file. The CHANGELOG is available on [Github](https://github.com/luc-tielen/souffle-haskell.git/CHANGELOG.md). +## [0.2.2] - 2020-04-30+### Changed++- Fix compile time issue when generically deriving `Marshal` typeclass+ for data types with more than 3 fields.+ ## [0.2.1] - 2020-04-25 ### Changed
lib/Language/Souffle/Internal/Constraints.hs view
@@ -43,7 +43,7 @@ % "Cannot derive void type.") type family OnlySimpleFields (t :: Type) (f :: Type -> Type) :: Constraint where- OnlySimpleFields t (a :*: b) = (OnlySimpleField t a, OnlySimpleFields t b)+ OnlySimpleFields t (a :*: b) = (OnlySimpleFields t a, OnlySimpleFields t b) OnlySimpleFields t (a :+: b) = (OnlySimpleFields t a, OnlySimpleFields t b) OnlySimpleFields t (M1 _ _ a) = OnlySimpleFields t a OnlySimpleFields _ U1 = ()
souffle-haskell.cabal view
@@ -4,10 +4,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: b4363dbe7c0e0f23b17900dd5d83779164070f75697dd2b0ffd9afb55628c1d9+-- hash: 25ea3b610616a6824b69546c184f2e1fd2cdcb36e648715c6166441f27013011 name: souffle-haskell-version: 0.2.1+version: 0.2.2 synopsis: Souffle Datalog bindings for Haskell description: Souffle Datalog bindings for Haskell. category: Logic Programming, Foreign Binding, Bindings@@ -77,6 +77,7 @@ other-modules: Test.Language.Souffle.CompiledSpec Test.Language.Souffle.InterpretedSpec+ Test.Language.Souffle.MarshalSpec Paths_souffle_haskell hs-source-dirs: tests
+ tests/Test/Language/Souffle/MarshalSpec.hs view
@@ -0,0 +1,66 @@++{-# LANGUAGE DeriveGeneric #-}++module Test.Language.Souffle.MarshalSpec+ ( module Test.Language.Souffle.MarshalSpec+ ) where++import Test.Hspec+import GHC.Generics+import Language.Souffle.Marshal+import Data.Text+import Data.Int+++data Edge = Edge String String+ deriving (Eq, Show, Generic)++data EdgeStrict = EdgeStrict !String !String+ deriving (Eq, Show, Generic)++data EdgeUnpacked+ = EdgeUnpacked {-# UNPACK #-} !Int32 {-# UNPACK #-} !Int32+ deriving (Eq, Show, Generic)++type Vertex = Text+type Vertex' = Text++data EdgeSynonyms = EdgeSynonyms Vertex Vertex+ deriving (Eq, Show, Generic)++data EdgeMultipleSynonyms = EdgeMultipleSynonyms Vertex Vertex'+ deriving (Eq, Show, Generic)++data EdgeMixed = EdgeMixed Text Vertex+ deriving (Eq, Show, Generic)++data EdgeRecord+ = EdgeRecord+ { fromNode :: Text+ , toNode :: Text+ } deriving (Eq, Show, Generic)++data IntsAndStrings = IntsAndStrings Text Int32 Text+ deriving (Eq, Show, Generic)++data LargeRecord+ = LargeRecord Int32 Int32 Int32 Int32+ deriving (Eq, Show, Generic)+++instance Marshal Edge+instance Marshal EdgeStrict+instance Marshal EdgeUnpacked+instance Marshal EdgeSynonyms+instance Marshal EdgeMultipleSynonyms+instance Marshal EdgeMixed+instance Marshal EdgeRecord+instance Marshal IntsAndStrings+instance Marshal LargeRecord+++spec :: Spec+spec = describe "Auto-deriving marshalling code" $+ it "can generate code for all instances in this file" $+ -- If this file compiles, then the test has already passed+ 42 `shouldBe` 42