packages feed

souffle-haskell 0.2.0 → 0.2.1

raw patch · 3 files changed

+37/−7 lines, 3 filesdep −freePVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependencies removed: free

API changes (from Hackage documentation)

- Language.Souffle.Marshal: type MarshalM = Free
+ Language.Souffle.Marshal: data MarshalM f a
+ Language.Souffle.Marshal: instance GHC.Base.Functor f => GHC.Base.Applicative (Language.Souffle.Marshal.MarshalM f)
+ Language.Souffle.Marshal: instance GHC.Base.Functor f => GHC.Base.Functor (Language.Souffle.Marshal.MarshalM f)
+ Language.Souffle.Marshal: instance GHC.Base.Functor f => GHC.Base.Monad (Language.Souffle.Marshal.MarshalM f)

Files

CHANGELOG.md view
@@ -4,6 +4,13 @@ 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.1] - 2020-04-25+### Changed++- Trimmed dependencies to make the library more lightweight.++ ## [0.2.0] - 2020-04-22 ### Added @@ -17,6 +24,7 @@  - Introduced Language.Souffle.Class module as separation of the typeclass and the   Language.Souffle.Compiled module to offer a uniform API in both interpreted and compiled mode.+  ## [0.1.0] - 2019-12-21 ### Added
lib/Language/Souffle/Marshal.hs view
@@ -15,7 +15,6 @@   , interpret   ) where -import Control.Monad.Free import GHC.Generics import Data.Int import qualified Data.Text as T@@ -37,15 +36,40 @@   | PushStr String a   deriving Functor +-- NOTE: Free is reimplemented here to avoid pulling in quite a few+--       dependencies and since we only need 2 functions+ -- | The monad used for serializing and deserializing of values that --   implement the `Marshal` typeclass.-type MarshalM = Free+data MarshalM f a+  = Pure a+  | Free (f (MarshalM f a))+  deriving Functor +instance Functor f => Applicative (MarshalM f) where+  pure = Pure+  {-# INLINABLE pure #-}+  Pure f <*> Pure a = Pure $ f a+  Pure f <*> Free fa = f <$> Free fa+  Free fa <*> m = Free $ fmap (<*> m) fa+  {-# INLINABLE (<*>) #-}++instance Functor f => Monad (MarshalM f) where+  Pure a >>= f = f a+  Free fa >>= f = Free $ fmap (>>= f) fa+  {-# INLINABLE (>>=) #-}++liftF :: Functor f => f a -> MarshalM f a+liftF action = Free $ fmap pure action+{-# INLINABLE liftF #-}+ -- | Helper function for interpreting the actual (de-)serialization of values. --   This allows both the compiled and interpreted variant to handle --   (de-)serialization in their own way. interpret :: Monad m => (forall x. f x -> m x) -> MarshalM f a -> m a-interpret = foldFree+interpret f = \case+  Pure a -> pure a+  Free fa -> f fa >>= interpret f {-# INLINABLE interpret #-}  {- | A typeclass for providing a uniform API to marshal/unmarshal values
souffle-haskell.cabal view
@@ -4,10 +4,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: 3cc0bdbc7d2a4e5c9d8aa3151d7c875a61de85bddc1f6d1136c77e58cb874c3e+-- hash: b4363dbe7c0e0f23b17900dd5d83779164070f75697dd2b0ffd9afb55628c1d9  name:           souffle-haskell-version:        0.2.0+version:        0.2.1 synopsis:       Souffle Datalog bindings for Haskell description:    Souffle Datalog bindings for Haskell. category:       Logic Programming, Foreign Binding, Bindings@@ -57,7 +57,6 @@     , deepseq >=1.4.4 && <2     , directory >=1.3.3 && <2     , filepath >=1.4.2 && <2-    , free >=5.1 && <6     , mtl >=2.0 && <3     , process >=1.6 && <2     , template-haskell >=2 && <3@@ -91,7 +90,6 @@     , deepseq >=1.4.4 && <2     , directory >=1.3.3 && <2     , filepath >=1.4.2 && <2-    , free >=5.1 && <6     , hspec >=2.6.1 && <3.0.0     , mtl >=2.0 && <3     , process >=1.6 && <2