Safe Haskell | None |
---|---|
Language | Haskell2010 |
This module exposes a uniform interface to marshal values
to and from Souffle Datalog. This is done via the Marshal
typeclass.
Also, a mechanism is exposed for generically deriving marshalling
and unmarshalling code for simple product types.
Documentation
class Marshal a where Source #
A typeclass for providing a uniform API to marshal/unmarshal values between Haskell and Souffle datalog.
The marshalling is done via a stack-based approach, where elements are pushed/popped one by one. You need to make sure that the marshalling of values happens in the correct order or unexpected things might happen (including crashes). Pushing and popping of fields should happen in the same order (from left to right, as defined in Datalog).
Generic implementations for push
and pop
that perform the previously
described behavior are available. This makes it possible to
write very succinct code:
data Edge = Edge String String deriving Generic instance Marshal Edge
Nothing
push :: MonadPush m => a -> m () Source #
Marshals a value to the datalog side.
pop :: MonadPop m => m a Source #
Unmarshals a value from the datalog side.
push :: (Generic a, SimpleProduct a (Rep a), GMarshal (Rep a), MonadPush m) => a -> m () Source #
Marshals a value to the datalog side.
pop :: (Generic a, SimpleProduct a (Rep a), GMarshal (Rep a), MonadPop m) => m a Source #
Unmarshals a value from the datalog side.
class Monad m => MonadPush m where Source #
A typeclass for serializing primitive values from Haskell to Datalog.
This typeclass is only used internally and subject to change.