graft-0.0.0
Safe HaskellSafe-Inferred
LanguageHaskell2010

Logic.SingleStep

Synopsis

Simple effects

class InterpretMod (mod :: Type) (m :: Type -> Type) (op :: Effect) where Source #

Explain how to interpret an atomic modification, applied an operation of a simple effect type (i.e. one that does not have any higher-order effects).

  • mod is the type of atomic modifications
  • m is a domain into which the modified operation will be interpreted (a monad)
  • op is the effect type.

Methods

interpretMod :: op (AST dummy) a -> ModInterp mod m a Source #

interpretMod takes the current operation, an atomic modification and describes how they should interact.

There are the following possibilities, corresponding to the constructors of LtlInterp:

  • If you want to ignore the current operation, make it Invisible. Invisible operations will be ignored by the modification process, but still executed.
  • If you want to try applying the modification, use Visible. Depending on the current state reached so far, the application of the modification can fail. Hence, there are two options:
  • If the modification successfully applies, return some computation that returns Just.
  • If the modification fails to apply, return Nothing.

The dummy type variable signifies that the "nesting" monad of the effect type is irrelevant, since we're not dealing with higher-order effects.

Instances

Instances details
MonadAccounts m => InterpretMod AccountsMod m MonadAccountsEffect Source # 
Instance details

Defined in Examples.Account.PaymentMod

Methods

interpretMod :: forall (dummy :: [Effect]) a. MonadAccountsEffect (AST dummy) a -> ModInterp AccountsMod m a Source #

(MonadError KeyValueError m, MonadKeyValue m) => InterpretMod KeyValueMod m MonadKeyValueEffect Source # 
Instance details

Defined in Examples.Ltl.Simple

Methods

interpretMod :: forall (dummy :: [Effect]) a. MonadKeyValueEffect (AST dummy) a -> ModInterp KeyValueMod m a Source #

data ModInterp mod m a Source #

Codomain of interpretLtl. See the explanation there.

Constructors

Invisible 
Visible (mod -> m (Maybe a))