@@ -495,8 +495,8 @@ values:
495 Env = List (String, Integer)
495 Env = List (String, Integer)
497 eval : Expr -> Eff Integer [EXCEPTION String, STATE Env]
497 eval : Expr -> Eff Integer [EXCEPTION String, STATE Env]
498− eval (Val x) = return x
498+ eval (Val x) = pure x
499− eval (Add l r) = return $ !(eval l) + !(eval r)
499+ eval (Add l r) = pure $ !(eval l) + !(eval r)
501Note that we are using ``!``-notation to avoid having to bind
501Note that we are using ``!``-notation to avoid having to bind
502subexpressions in a ``do`` block. Next, we add a case for evaluating
502subexpressions in a ``do`` block. Next, we add a case for evaluating
@@ -506,7 +506,7 @@ subexpressions in a ``do`` block. Next, we add a case for evaluating
507 eval (Var x) = case lookup x !get of
507 eval (Var x) = case lookup x !get of
508 Nothing => raise $ "No such variable " ++ x
508 Nothing => raise $ "No such variable " ++ x
509− Just val => return val
509+ Just val => pure val
511This retrieves the state (with ``get``, supported by the ``STATE Env``
511This retrieves the state (with ``get``, supported by the ``STATE Env``
512effect) and raises an exception if the variable is not in the
512effect) and raises an exception if the variable is not in the
@@ -559,7 +559,7 @@ has been generated:
560 eval (Random upper) = do val <- rndInt 0 upper
560 eval (Random upper) = do val <- rndInt 0 upper
561 putStrLn (show val)
561 putStrLn (show val)
562− return val
562+ pure val
564If we try this without extending the effects list, we would see an
564If we try this without extending the effects list, we would see an
565error something like the following:
565error something like the following: