Eval is a Monad that makes it easier to define parallel
strategies. It is a strict identity monad: that is, in
m >>= f
m is evaluated before the result is passed to
f.
instance Monad Eval where
return = Done
m >>= k = case m of
Done x -> k x
If you wanted to construct a
Strategy for a pair that sparked
the first component in parallel and then evaluated the second
component, you could write
myStrat :: Strategy (a,b)
myStrat (a,b) = do { a' <- rpar a; b' <- rseq b; return (a',b') }
Alternatively, you could write this more compactly using the
Applicative style as
myStrat (a,b) = (,) <$> rpar a <*> rseq b