Safe Haskell | None |
---|---|
Language | Haskell2010 |
Documentation
A monad transformer, used solely for marshalling and unmarshalling between Haskell and Souffle Datalog.
Instances
MonadTrans MarshalT Source # | |
Defined in Language.Souffle.Marshal | |
MonadWriter w m => MonadWriter w (MarshalT m) Source # | |
MonadState s m => MonadState s (MarshalT m) Source # | |
MonadError e m => MonadError e (MarshalT m) Source # | |
Defined in Language.Souffle.Marshal throwError :: e -> MarshalT m a # catchError :: MarshalT m a -> (e -> MarshalT m a) -> MarshalT m a # | |
Monad m => Monad (MarshalT m) Source # | |
Functor m => Functor (MarshalT m) Source # | |
Applicative m => Applicative (MarshalT m) Source # | |
Defined in Language.Souffle.Marshal | |
MonadIO m => MonadIO (MarshalT m) Source # | |
Defined in Language.Souffle.Marshal |
runMarshalT :: MarshalT m a -> Tuple -> m a Source #
Execute the monad transformer and return the result. The tuple that is passed in will be used to marshal the data back and forth.
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. The programmer needs to make sure that the marshalling 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 :: MonadIO m => a -> MarshalT m () Source #
Marshals a value to the datalog side.
default push :: (Generic a, SimpleProduct a (Rep a), GMarshal (Rep a), MonadIO m) => a -> MarshalT m () Source #
pop :: MonadIO m => MarshalT m a Source #
Unmarshals a value from the datalog side.