souffle-haskell 3.5.0 → 3.5.1
raw patch · 8 files changed
+165/−50 lines, 8 filesdep −type-errors-prettyPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependencies removed: type-errors-pretty
API changes (from Hackage documentation)
+ Language.Souffle.Class: instance (Language.Souffle.Class.MonadSouffle m, GHC.Base.Monoid w) => Language.Souffle.Class.MonadSouffle (Control.Monad.Trans.RWS.Lazy.RWST r w s m)
+ Language.Souffle.Class: instance (Language.Souffle.Class.MonadSouffleFileIO m, GHC.Base.Monoid w) => Language.Souffle.Class.MonadSouffleFileIO (Control.Monad.Trans.RWS.Lazy.RWST r w s m)
+ Language.Souffle.Class: instance Language.Souffle.Class.MonadSouffle m => Language.Souffle.Class.MonadSouffle (Control.Monad.Trans.State.Strict.StateT s m)
+ Language.Souffle.Class: instance Language.Souffle.Class.MonadSouffleFileIO m => Language.Souffle.Class.MonadSouffleFileIO (Control.Monad.Trans.State.Strict.StateT s m)
- Language.Souffle.Class: FactOptions :: fact -> FactOptions (fact :: Type) (factName :: Symbol) (dir :: Direction)
+ Language.Souffle.Class: FactOptions :: fact -> FactOptions fact factName dir
- Language.Souffle.Class: ProgramOptions :: prog -> ProgramOptions (prog :: Type) (progName :: Symbol) (facts :: [Type])
+ Language.Souffle.Class: ProgramOptions :: prog -> ProgramOptions prog progName facts
- Language.Souffle.Class: newtype FactOptions (fact :: Type) (factName :: Symbol) (dir :: Direction)
+ Language.Souffle.Class: newtype FactOptions fact factName dir
- Language.Souffle.Class: newtype ProgramOptions (prog :: Type) (progName :: Symbol) (facts :: [Type])
+ Language.Souffle.Class: newtype ProgramOptions prog progName facts
- Language.Souffle.Compiled: FactOptions :: fact -> FactOptions (fact :: Type) (factName :: Symbol) (dir :: Direction)
+ Language.Souffle.Compiled: FactOptions :: fact -> FactOptions fact factName dir
- Language.Souffle.Compiled: ProgramOptions :: prog -> ProgramOptions (prog :: Type) (progName :: Symbol) (facts :: [Type])
+ Language.Souffle.Compiled: ProgramOptions :: prog -> ProgramOptions prog progName facts
- Language.Souffle.Compiled: newtype FactOptions (fact :: Type) (factName :: Symbol) (dir :: Direction)
+ Language.Souffle.Compiled: newtype FactOptions fact factName dir
- Language.Souffle.Compiled: newtype ProgramOptions (prog :: Type) (progName :: Symbol) (facts :: [Type])
+ Language.Souffle.Compiled: newtype ProgramOptions prog progName facts
- Language.Souffle.Interpreted: FactOptions :: fact -> FactOptions (fact :: Type) (factName :: Symbol) (dir :: Direction)
+ Language.Souffle.Interpreted: FactOptions :: fact -> FactOptions fact factName dir
- Language.Souffle.Interpreted: ProgramOptions :: prog -> ProgramOptions (prog :: Type) (progName :: Symbol) (facts :: [Type])
+ Language.Souffle.Interpreted: ProgramOptions :: prog -> ProgramOptions prog progName facts
- Language.Souffle.Interpreted: newtype FactOptions (fact :: Type) (factName :: Symbol) (dir :: Direction)
+ Language.Souffle.Interpreted: newtype FactOptions fact factName dir
- Language.Souffle.Interpreted: newtype ProgramOptions (prog :: Type) (progName :: Symbol) (facts :: [Type])
+ Language.Souffle.Interpreted: newtype ProgramOptions prog progName facts
- Language.Souffle.Marshal: type family SimpleProduct (a :: Type) :: Constraint
+ Language.Souffle.Marshal: type family SimpleProduct a
Files
- CHANGELOG.md +10/−0
- lib/Language/Souffle/Analysis.hs +2/−0
- lib/Language/Souffle/Class.hs +100/−33
- lib/Language/Souffle/Compiled.hs +18/−3
- lib/Language/Souffle/Internal/Bindings.hs +4/−0
- lib/Language/Souffle/Interpreted.hs +7/−0
- lib/Language/Souffle/Marshal.hs +19/−11
- souffle-haskell.cabal +5/−3
CHANGELOG.md view
@@ -3,6 +3,16 @@ 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). +## [3.5.1] - 2022-11-07++### Added++- Instances for strict `State` and `RWS` monads for `MonadSouffle`.++### Changed++- Added support for GHC 9.2+ ## [3.5.0] - 2022-06-04 ### Changed
lib/Language/Souffle/Analysis.hs view
@@ -17,6 +17,7 @@ ) where import Prelude hiding (id, (.))+import Data.Kind (Type) import Control.Category import Control.Monad import Control.Arrow@@ -31,6 +32,7 @@ -- "Language.Souffle.Compiled" or "Language.Souffle.Interpreted". -- The @a@ and @b@ type-variables represent respectively the input and output -- types of the analysis.+type Analysis :: (Type -> Type) -> Type -> Type -> Type data Analysis m a b = Analysis (a -> m ()) (m ()) (a -> m b)
lib/Language/Souffle/Class.hs view
@@ -30,51 +30,57 @@ import Prelude hiding ( init ) import Control.Monad.Except-import Control.Monad.RWS.Strict import Control.Monad.Reader-import Control.Monad.State import Control.Monad.Writer+import qualified Control.Monad.RWS.Strict as StrictRWS+import qualified Control.Monad.RWS.Lazy as LazyRWS+import qualified Control.Monad.State.Strict as StrictState+import qualified Control.Monad.State.Lazy as LazyState import Data.Proxy import Data.Kind import Data.Word import GHC.TypeLits import qualified Language.Souffle.Marshal as Marshal-import Type.Errors.Pretty -- | A helper type family for checking if a specific Souffle `Program` contains -- a certain `Fact`. Additionally, it also checks if the fact is marked as -- either `Input` or `InputOutput`. This constraint will generate a -- user-friendly type error if these conditions are not met.-type family ContainsInputFact prog fact :: Constraint where+type ContainsInputFact :: Type -> Type -> Constraint+type family ContainsInputFact prog fact where ContainsInputFact prog fact = (ContainsFact prog fact, IsInput fact (FactDirection fact)) -- | A helper type family for checking if a specific Souffle `Program` contains -- a certain `Fact`. Additionally, it also checks if the fact is marked as -- either `Output` or `InputOutput`. This constraint will generate a -- user-friendly type error if these conditions are not met.-type family ContainsOutputFact prog fact :: Constraint where+type ContainsOutputFact :: Type -> Type -> Constraint+type family ContainsOutputFact prog fact where ContainsOutputFact prog fact = (ContainsFact prog fact, IsOutput fact (FactDirection fact)) -type family IsInput (fact :: Type) (dir :: Direction) :: Constraint where+type IsInput :: Type -> Direction -> Constraint+type family IsInput fact dir where IsInput _ 'Input = () IsInput _ 'InputOutput = () IsInput fact dir = TypeError- ( "You tried to use an " <> FormatDirection dir <> " fact of type " <> fact <> " as an input."- % "Possible solution: change the FactDirection of " <> fact- <> " to either 'Input' or 'InputOutput'."+ ( 'Text "You tried to use an " ':<>: 'ShowType (FormatDirection dir) ':<>: 'Text " fact of type " ':<>: 'ShowType fact ':<>: 'Text " as an input."+ ':$$: 'Text "Possible solution: change the FactDirection of " ':<>: 'ShowType fact+ ':<>: 'Text " to either 'Input' or 'InputOutput'." ) -type family IsOutput (fact :: Type) (dir :: Direction) :: Constraint where+type IsOutput :: Type -> Direction -> Constraint+type family IsOutput fact dir where IsOutput _ 'Output = () IsOutput _ 'InputOutput = () IsOutput fact dir = TypeError- ( "You tried to use an " <> FormatDirection dir <> " fact of type " <> fact <> " as an output."- % "Possible solution: change the FactDirection of " <> fact- <> " to either 'Output' or 'InputOutput'."+ ( 'Text "You tried to use an " ':<>: 'ShowType (FormatDirection dir) ':<>: 'Text " fact of type " ':<>: 'ShowType fact ':<>: 'Text " as an output."+ ':$$: 'Text "Possible solution: change the FactDirection of " ':<>: 'ShowType fact+ ':<>: 'Text " to either 'Output' or 'InputOutput'." ) -type family FormatDirection (dir :: Direction) where+type FormatDirection :: Direction -> Symbol+type family FormatDirection dir where FormatDirection 'Output = "output" FormatDirection 'Input = "input" FormatDirection 'Internal = "internal"@@ -82,18 +88,20 @@ -- | A helper type family for checking if a specific Souffle `Program` contains -- a certain `Fact`. This constraint will generate a user-friendly type error -- if this is not the case.-type family ContainsFact prog fact :: Constraint where+type ContainsFact :: Type -> Type -> Constraint+type family ContainsFact prog fact where ContainsFact prog fact = CheckContains prog (ProgramFacts prog) fact +type CheckContains :: Type -> [Type] -> Type -> Constraint type family CheckContains prog facts fact :: Constraint where CheckContains prog '[] fact =- TypeError ("You tried to perform an action with a fact of type '" <> fact- <> "' for program '" <> prog <> "'."- % "The program contains the following facts: " <> ProgramFacts prog <> "."- % "It does not contain fact: " <> fact <> "."- % "You can fix this error by adding the type '" <> fact- <> "' to the ProgramFacts type in the Program instance for " <> prog <> ".")+ TypeError ('Text "You tried to perform an action with a fact of type '" ':<>: 'ShowType fact+ ':<>: 'Text "' for program '" ':<>: 'ShowType prog ':<>: 'Text "'."+ ':$$: 'Text "The program contains the following facts: " ':<>: 'ShowType (ProgramFacts prog) ':<>: 'Text "."+ ':$$: 'Text "It does not contain fact: " ':<>: 'ShowType fact ':<>: 'Text "."+ ':$$: 'Text "You can fix this error by adding the type '" ':<>: 'ShowType fact+ ':<>: 'Text "' to the ProgramFacts type in the Program instance for " ':<>: 'ShowType prog ':<>: 'Text ".") CheckContains _ (a ': _) a = () CheckContains prog (_ ': as) b = CheckContains prog as b @@ -109,6 +117,7 @@ -- type ProgramFacts Path = '[Edge, Reachable] -- programName = const "path" -- @+type Program :: Type -> Constraint class Program a where -- | A type level list of facts that belong to this program. -- This list is used to check that only known facts are added to a program.@@ -132,7 +141,8 @@ -- @ -- -- See also: 'FactOptions'.-newtype ProgramOptions (prog :: Type) (progName :: Symbol) (facts :: [Type])+type ProgramOptions :: Type -> Symbol -> [Type] -> Type+newtype ProgramOptions prog progName facts = ProgramOptions prog instance KnownSymbol progName => Program (ProgramOptions prog progName facts) where@@ -150,6 +160,7 @@ -- type FactDirection Edge = 'Input -- factName = const "edge" -- @+type Fact :: Type -> Constraint class Marshal.Marshal a => Fact a where -- | The direction or "mode" a fact can be used in. -- This is used to perform compile-time checks that a fact is only used@@ -179,7 +190,8 @@ -- @ -- -- See also: 'ProgramOptions'.-newtype FactOptions (fact :: Type) (factName :: Symbol) (dir :: Direction)+type FactOptions :: Type -> Symbol -> Direction -> Type+newtype FactOptions fact factName dir = FactOptions fact instance Marshal.Marshal fact => Marshal.Marshal (FactOptions fact name dir) where@@ -200,6 +212,7 @@ -- | A datatype describing which operations a certain fact supports. -- The direction is from the datalog perspective, so that it -- aligns with ".decl" statements in Souffle.+type Direction :: Type data Direction = Input -- ^ Fact can only be stored in Datalog (using `addFact`/`addFacts`).@@ -212,6 +225,7 @@ -- facts that are only visible inside Datalog itself. -- | A mtl-style typeclass for Souffle-related actions.+type MonadSouffle :: (Type -> Type) -> Constraint class Monad m => MonadSouffle m where -- | Represents a handle for interacting with a Souffle program. --@@ -297,10 +311,10 @@ addFacts facts = lift . addFacts facts {-# INLINABLE addFacts #-} -instance MonadSouffle m => MonadSouffle (StateT s m) where- type Handler (StateT s m) = Handler m- type CollectFacts (StateT s m) c = CollectFacts m c- type SubmitFacts (StateT s m) a = SubmitFacts m a+instance MonadSouffle m => MonadSouffle (LazyState.StateT s m) where+ type Handler (LazyState.StateT s m) = Handler m+ type CollectFacts (LazyState.StateT s m) c = CollectFacts m c+ type SubmitFacts (LazyState.StateT s m) a = SubmitFacts m a run = lift . run {-# INLINABLE run #-}@@ -317,10 +331,10 @@ addFacts facts = lift . addFacts facts {-# INLINABLE addFacts #-} -instance (MonadSouffle m, Monoid w) => MonadSouffle (RWST r w s m) where- type Handler (RWST r w s m) = Handler m- type CollectFacts (RWST r w s m) c = CollectFacts m c- type SubmitFacts (RWST r w s m) a = SubmitFacts m a+instance MonadSouffle m => MonadSouffle (StrictState.StateT s m) where+ type Handler (StrictState.StateT s m) = Handler m+ type CollectFacts (StrictState.StateT s m) c = CollectFacts m c+ type SubmitFacts (StrictState.StateT s m) a = SubmitFacts m a run = lift . run {-# INLINABLE run #-}@@ -337,6 +351,46 @@ addFacts facts = lift . addFacts facts {-# INLINABLE addFacts #-} +instance (MonadSouffle m, Monoid w) => MonadSouffle (LazyRWS.RWST r w s m) where+ type Handler (LazyRWS.RWST r w s m) = Handler m+ type CollectFacts (LazyRWS.RWST r w s m) c = CollectFacts m c+ type SubmitFacts (LazyRWS.RWST r w s m) a = SubmitFacts m a++ run = lift . run+ {-# INLINABLE run #-}+ setNumThreads prog = lift . setNumThreads prog+ {-# INLINABLE setNumThreads #-}+ getNumThreads = lift . getNumThreads+ {-# INLINABLE getNumThreads #-}+ getFacts = lift . getFacts+ {-# INLINABLE getFacts #-}+ findFact prog = lift . findFact prog+ {-# INLINABLE findFact #-}+ addFact fact = lift . addFact fact+ {-# INLINABLE addFact #-}+ addFacts facts = lift . addFacts facts+ {-# INLINABLE addFacts #-}++instance (MonadSouffle m, Monoid w) => MonadSouffle (StrictRWS.RWST r w s m) where+ type Handler (StrictRWS.RWST r w s m) = Handler m+ type CollectFacts (StrictRWS.RWST r w s m) c = CollectFacts m c+ type SubmitFacts (StrictRWS.RWST r w s m) a = SubmitFacts m a++ run = lift . run+ {-# INLINABLE run #-}+ setNumThreads prog = lift . setNumThreads prog+ {-# INLINABLE setNumThreads #-}+ getNumThreads = lift . getNumThreads+ {-# INLINABLE getNumThreads #-}+ getFacts = lift . getFacts+ {-# INLINABLE getFacts #-}+ findFact prog = lift . findFact prog+ {-# INLINABLE findFact #-}+ addFact fact = lift . addFact fact+ {-# INLINABLE addFact #-}+ addFacts facts = lift . addFacts facts+ {-# INLINABLE addFacts #-}+ instance MonadSouffle m => MonadSouffle (ExceptT e m) where type Handler (ExceptT e m) = Handler m type CollectFacts (ExceptT e m) c = CollectFacts m c@@ -358,6 +412,7 @@ {-# INLINABLE addFacts #-} -- | A mtl-style typeclass for Souffle-related actions that involve file IO.+type MonadSouffleFileIO :: (Type -> Type) -> Constraint class MonadSouffle m => MonadSouffleFileIO m where -- | Load all facts from files in a certain directory. loadFiles :: Handler m prog -> FilePath -> m ()@@ -378,13 +433,25 @@ writeFiles prog = lift . writeFiles prog {-# INLINABLE writeFiles #-} -instance MonadSouffleFileIO m => MonadSouffleFileIO (StateT s m) where+instance MonadSouffleFileIO m => MonadSouffleFileIO (StrictState.StateT s m) where loadFiles prog = lift . loadFiles prog {-# INLINABLE loadFiles #-} writeFiles prog = lift . writeFiles prog {-# INLINABLE writeFiles #-} -instance (MonadSouffleFileIO m, Monoid w) => MonadSouffleFileIO (RWST r w s m) where+instance MonadSouffleFileIO m => MonadSouffleFileIO (LazyState.StateT s m) where+ loadFiles prog = lift . loadFiles prog+ {-# INLINABLE loadFiles #-}+ writeFiles prog = lift . writeFiles prog+ {-# INLINABLE writeFiles #-}++instance (MonadSouffleFileIO m, Monoid w) => MonadSouffleFileIO (LazyRWS.RWST r w s m) where+ loadFiles prog = lift . loadFiles prog+ {-# INLINABLE loadFiles #-}+ writeFiles prog = lift . writeFiles prog+ {-# INLINABLE writeFiles #-}++instance (MonadSouffleFileIO m, Monoid w) => MonadSouffleFileIO (StrictRWS.RWST r w s m) where loadFiles prog = lift . loadFiles prog {-# INLINABLE loadFiles #-} writeFiles prog = lift . writeFiles prog
lib/Language/Souffle/Compiled.hs view
@@ -63,9 +63,12 @@ import Control.Concurrent +type ByteCount :: Type type ByteCount = Int+type ByteBuf :: Type type ByteBuf = Internal.ByteBuf +type BufData :: Type data BufData = BufData { bufPtr :: {-# UNPACK #-} !(ForeignPtr ByteBuf)@@ -75,12 +78,14 @@ -- | A datatype representing a handle to a datalog program. -- The type parameter is used for keeping track of which program -- type the handle belongs to for additional type safety.+type Handle :: Type -> Type data Handle prog = Handle {-# UNPACK #-} !(ForeignPtr Internal.Souffle) {-# UNPACK #-} !(MVar BufData) type role Handle nominal -- | A monad for executing Souffle-related actions in.+type SouffleM :: Type -> Type newtype SouffleM a = SouffleM (IO a) deriving (Functor, Applicative, Monad, MonadIO) via IO deriving (Semigroup, Monoid) via (IO a)@@ -114,6 +119,7 @@ -- marshalling from Haskell to C++ and the exact size of a datastructure -- is statically known (read: data type contains no string-like types), -- or when marshalling from C++ to Haskell (pointer is then managed by C++).+type CMarshalFast :: Type -> Type newtype CMarshalFast a = CMarshalFast (StateT (Ptr ByteBuf) IO a) deriving (Functor, Applicative, Monad, MonadIO, MonadState (Ptr ByteBuf)) via (StateT (Ptr ByteBuf) IO)@@ -181,6 +187,7 @@ {-# INLINABLE popText #-} +type MarshalState :: Type data MarshalState = MarshalState { _buf :: {-# UNPACK #-} !BufData@@ -191,6 +198,7 @@ -- | A monad used solely for marshalling from Haskell to Souffle Datalog (C++). -- This slow variant is used when the exact size of a datastructure is *not* -- statically known (read: data type contains string-like types).+type CMarshalSlow :: Type -> Type newtype CMarshalSlow a = CMarshalSlow (StateT MarshalState IO a) deriving (Functor, Applicative, Monad, MonadIO, MonadState MarshalState) via (StateT MarshalState IO)@@ -275,6 +283,7 @@ {-# INLINABLE writeAsBytesSlow #-} +type Collect :: (Type -> Type) -> Constraint class Collect c where collect :: Marshal a => Word32 -> CMarshalFast (c a) @@ -318,6 +327,7 @@ -- | A helper typeclass constraint, needed to serialize Datalog facts from -- Haskell to C++.+type Submit :: Type -> Constraint type Submit a = ToByteSize (GetFields (Rep a)) instance MonadSouffle SouffleM where@@ -394,6 +404,7 @@ {-# INLINABLE writeFiles #-} +type ByteSize :: Type data ByteSize = Exact {-# UNPACK #-} !ByteCount | Estimated {-# UNPACK #-} !ByteCount@@ -405,7 +416,8 @@ Estimated s1 <> Estimated s2 = Estimated (s1 + s2) {-# INLINABLE (<>) #-} -class ToByteSize (a :: k) where+type ToByteSize :: k -> Constraint+class ToByteSize a where toByteSize :: Proxy a -> ByteSize instance ToByteSize Int32 where@@ -450,12 +462,14 @@ {-# INLINABLE toByteSize #-} -- | A helper type family, for getting all directly marshallable fields of a type.-type family GetFields (a :: k) :: [Type] where+type GetFields :: k -> [Type]+type family GetFields a where GetFields (K1 _ a) = DoGetFields a GetFields (M1 _ _ a) = GetFields a GetFields (f :*: g) = GetFields f ++ GetFields g -type family DoGetFields (a :: Type) :: [Type] where+type DoGetFields :: Type -> [Type]+type family DoGetFields a where DoGetFields Int32 = '[Int32] DoGetFields Word32 = '[Word32] DoGetFields Float = '[Float]@@ -465,6 +479,7 @@ DoGetFields TS.ShortText = '[TS.ShortText] DoGetFields a = GetFields (Rep a) +type (++) :: [Type] -> [Type] -> [Type] type family a ++ b where '[] ++ b = b (a ': as) ++ bs = a ': as ++ bs
lib/Language/Souffle/Internal/Bindings.hs view
@@ -20,6 +20,7 @@ ) where import Prelude hiding ( init )+import Data.Kind (Type) import Foreign.C.String import Foreign.C.Types import Foreign.Ptr@@ -27,12 +28,15 @@ -- | A void type, used for tagging a pointer that points to an embedded -- Souffle program.+type Souffle :: Type data Souffle -- | A void type, used for tagging a pointer that points to a relation.+type Relation :: Type data Relation -- | A void type, used for tagging a pointer that points to a raw bytearray.+type ByteBuf :: Type data ByteBuf
lib/Language/Souffle/Interpreted.hs view
@@ -31,6 +31,7 @@ ) where import Prelude hiding (init)+import Data.Kind (Type, Constraint) import Control.DeepSeq (deepseq) import Control.Exception (ErrorCall(..), throwIO, bracket)@@ -59,6 +60,7 @@ -- | A monad for executing Souffle-related actions in.+type SouffleM :: Type -> Type newtype SouffleM a = SouffleM (IO a) deriving (Functor, Applicative, Monad, MonadIO) via IO deriving (Semigroup, Monoid) via (IO a)@@ -75,6 +77,7 @@ -- souffle session. -- - __cfgOutputDir__: The directory where the output fact file(s) are created. -- If Nothing, it will be part of the temporary directory.+type Config :: Type data Config = Config { cfgDatalogDir :: FilePath@@ -168,6 +171,7 @@ -- | A datatype representing a handle to a datalog program. -- The type parameter is used for keeping track of which program -- type the handle belongs to for additional type safety.+type Handle :: Type -> Type data Handle prog = Handle { handleData :: IORef HandleData , stdoutResult :: IORef (Maybe T.Text)@@ -178,6 +182,7 @@ -- | The data needed for the interpreter is the path where the souffle -- executable can be found, and a template directory where the program -- is stored.+type HandleData :: Type data HandleData = HandleData { soufflePath :: FilePath , tmpDirPath :: FilePath@@ -187,6 +192,7 @@ , noOfThreads :: Word64 } +type IMarshal :: Type -> Type newtype IMarshal a = IMarshal (State [String] a) deriving (Functor, Applicative, Monad, MonadState [String]) via (State [String])@@ -253,6 +259,7 @@ pushMarshalT (IMarshal m) = reverse $ execState m [] {-# INLINABLE pushMarshalT #-} +type Collect :: (Type -> Type) -> Constraint class Collect c where collect :: Marshal a => FilePath -> IO (c a)
lib/Language/Souffle/Marshal.hs view
@@ -14,7 +14,7 @@ , SimpleProduct ) where -import Type.Errors.Pretty+import GHC.TypeLits import GHC.Generics import Data.Int import Data.Word@@ -29,6 +29,7 @@ See also: 'MonadPop', 'Marshal'. -}+type MonadPush :: (Type -> Type) -> Constraint class Monad m => MonadPush m where -- | Marshals a signed 32 bit integer to the datalog side. pushInt32 :: Int32 -> m ()@@ -49,6 +50,7 @@ See also: 'MonadPush', 'Marshal'. -}+type MonadPop :: (Type -> Type) -> Constraint class Monad m => MonadPop m where -- | Unmarshals a signed 32 bit integer from the datalog side. popInt32 :: m Int32@@ -84,6 +86,7 @@ instance Marshal Edge @ -}+type Marshal :: Type -> Constraint class Marshal a where -- | Marshals a value to the datalog side. push :: MonadPush m => a -> m ()@@ -143,6 +146,7 @@ pop = TL.fromStrict <$> pop {-# INLINABLE pop #-} +type GMarshal :: (Type -> Type) -> Constraint class GMarshal f where gpush :: MonadPush m => f a -> m () gpop :: MonadPop m => m (f a)@@ -176,24 +180,27 @@ -- -- A type error is returned if the passed in type is not a simple product type -- consisting of only types that implement 'Marshal'.-type family SimpleProduct (a :: Type) :: Constraint where+type SimpleProduct :: Type -> Constraint+type family SimpleProduct a where SimpleProduct a = (ProductLike a (Rep a), OnlyMarshallableFields (Rep a)) -type family ProductLike (t :: Type) (f :: Type -> Type) :: Constraint where+type ProductLike :: Type -> (Type -> Type) -> Constraint+type family ProductLike t f where ProductLike t (a :*: b) = (ProductLike t a, ProductLike t b) ProductLike t (M1 _ _ a) = ProductLike t a ProductLike _ (K1 _ _) = () ProductLike t (_ :+: _) =- TypeError ( "Error while deriving marshalling code for type " <> t <> ":"- % "Cannot derive sum type, only product types are supported.")+ TypeError ( 'Text "Error while deriving marshalling code for type " ':<>: 'ShowType t ':<>: 'Text ":"+ ':$$: 'Text "Cannot derive sum type, only product types are supported.") ProductLike t U1 =- TypeError ( "Error while deriving marshalling code for type " <> t <> ":"- % "Cannot automatically derive code for 0 argument constructor.")+ TypeError ( 'Text "Error while deriving marshalling code for type " ':<>: 'ShowType t ':<>: 'Text ":"+ ':$$: 'Text "Cannot automatically derive code for 0 argument constructor.") ProductLike t V1 =- TypeError ( "Error while deriving marshalling code for type " <> t <> ":"- % "Cannot derive void type.")+ TypeError ( 'Text "Error while deriving marshalling code for type " ':<>: 'ShowType t ':<>: 'Text ":"+ ':$$: 'Text "Cannot derive void type.") -type family OnlyMarshallableFields (f :: Type -> Type) :: Constraint where+type OnlyMarshallableFields :: (Type -> Type) -> Constraint+type family OnlyMarshallableFields f where OnlyMarshallableFields (a :*: b) = (OnlyMarshallableFields a, OnlyMarshallableFields b) OnlyMarshallableFields (a :+: b) = (OnlyMarshallableFields a, OnlyMarshallableFields b) OnlyMarshallableFields (M1 _ _ a) = OnlyMarshallableFields a@@ -201,6 +208,7 @@ OnlyMarshallableFields V1 = () OnlyMarshallableFields k = OnlyMarshallableField k -type family OnlyMarshallableField (f :: Type -> Type) :: Constraint where+type OnlyMarshallableField :: (Type -> Type) -> Constraint+type family OnlyMarshallableField f where OnlyMarshallableField (M1 _ _ a) = OnlyMarshallableField a OnlyMarshallableField (K1 _ a) = Marshal a
souffle-haskell.cabal view
@@ -5,7 +5,7 @@ -- see: https://github.com/sol/hpack name: souffle-haskell-version: 3.5.0+version: 3.5.1 synopsis: Souffle Datalog bindings for Haskell description: Souffle Datalog bindings for Haskell. category: Logic Programming, Foreign Binding, Bindings@@ -95,6 +95,7 @@ LambdaCase OverloadedStrings ScopedTypeVariables+ StandaloneKindSignatures ghc-options: -Wall -Weverything -Wno-safe -Wno-unsafe -Wno-implicit-prelude -Wno-missed-specializations -Wno-all-missed-specializations -Wno-missing-import-lists -Wno-type-defaults -Wno-missing-local-signatures -Wno-monomorphism-restriction -Wno-prepositive-qualified-module -Wno-missing-safe-haskell-mode -optP-Wno-nonportable-include-path -fhide-source-paths -fno-show-valid-hole-fits -fno-sort-valid-hole-fits cxx-options: -std=c++17 -Wall include-dirs:@@ -162,7 +163,6 @@ , temporary >=1.3 && <2 , text >=1.0 && <2 , text-short >=0.1.3 && <1- , type-errors-pretty >=0.0.1.0 && <1 , vector <=1.0 if os(linux) extra-libraries:@@ -189,7 +189,8 @@ LambdaCase OverloadedStrings ScopedTypeVariables- ghc-options: -Wall -Weverything -Wno-safe -Wno-unsafe -Wno-implicit-prelude -Wno-missed-specializations -Wno-all-missed-specializations -Wno-missing-import-lists -Wno-type-defaults -Wno-missing-local-signatures -Wno-monomorphism-restriction -Wno-prepositive-qualified-module -Wno-missing-safe-haskell-mode -optP-Wno-nonportable-include-path -fhide-source-paths -fno-show-valid-hole-fits -fno-sort-valid-hole-fits+ StandaloneKindSignatures+ ghc-options: -Wall -Weverything -Wno-safe -Wno-unsafe -Wno-implicit-prelude -Wno-missed-specializations -Wno-all-missed-specializations -Wno-missing-import-lists -Wno-type-defaults -Wno-missing-local-signatures -Wno-monomorphism-restriction -Wno-prepositive-qualified-module -Wno-missing-safe-haskell-mode -optP-Wno-nonportable-include-path -fhide-source-paths -fno-show-valid-hole-fits -fno-sort-valid-hole-fits -Wno-missing-kind-signatures -Wno-operator-whitespace cxx-options: -std=c++17 -D__EMBEDDED_SOUFFLE__ include-dirs: cbits@@ -278,6 +279,7 @@ LambdaCase OverloadedStrings ScopedTypeVariables+ StandaloneKindSignatures ghc-options: -Wall -Weverything -Wno-safe -Wno-unsafe -Wno-implicit-prelude -Wno-missed-specializations -Wno-all-missed-specializations -Wno-missing-import-lists -Wno-type-defaults -Wno-missing-local-signatures -Wno-monomorphism-restriction -Wno-prepositive-qualified-module -Wno-missing-safe-haskell-mode -optP-Wno-nonportable-include-path -fhide-source-paths -fno-show-valid-hole-fits -fno-sort-valid-hole-fits +RTS -N1 -RTS cxx-options: -std=c++17 -D__EMBEDDED_SOUFFLE__ -std=c++17 -march=native include-dirs: