Safe Haskell | None |
---|---|
Language | Haskell2010 |
Methods for traversing programs
- class DryInterp instr where
- dryInterp :: MonadSupply m => instr `(m, fs)` a -> m a
- observe_ :: (DryInterp instr, HFunctor instr, MonadSupply m) => (forall a. instr `(m, fs)` a -> a -> m ()) -> Program instr fs a -> m a
- observe :: (DryInterp instr, HFunctor instr, MonadSupply m) => (forall a. instr `(m, fs)` a -> a -> m a) -> Program instr fs a -> m a
Documentation
class DryInterp instr where Source
Dry (effect-less) interpretation of an instruction. This class is like
Interp
without the monad parameter, so it cannot have different instances
for different monads.
dryInterp :: MonadSupply m => instr `(m, fs)` a -> m a Source
Dry interpretation of an instruction. This function is like interp
except that it interprets in any monad that can supply fresh variables.
(DryInterp k i1, DryInterp k i2) => DryInterp k ((:+:) ((,) (* -> *) k) * i1 i2) Source | |
DryInterp ((,) (* -> *) ((,) (* -> Constraint) *)) C_CMD Source | |
DryInterp ((,) (* -> *) ((,) (* -> Constraint) *)) ControlCMD Source | |
DryInterp ((,) (* -> *) ((,) (* -> Constraint) *)) (FileCMD (* -> *)) Source | |
DryInterp ((,) (* -> *) ((,) (* -> Constraint) *)) (ArrCMD (* -> *)) Source | |
DryInterp ((,) (* -> *) ((,) (* -> Constraint) *)) (RefCMD (* -> *)) Source | |
DryInterp ((,) k ((,) k *)) (PtrCMD (* -> *) k k) Source |
:: (DryInterp instr, HFunctor instr, MonadSupply m) | |
=> (forall a. instr `(m, fs)` a -> a -> m ()) | Function for observing instructions |
-> Program instr fs a | |
-> m a |
Interpretation of a program as a combination of dry interpretation and effectful observation