X-Git-Url: http://lambda.jimpryor.net/git/gitweb.cgi?p=lambda.git;a=blobdiff_plain;f=exercises%2F_assignment8.mdwn;h=a05707ac7104d8b8449da3d336b7dfd51c60dfee;hp=cd1dc089d52e63eb001f216659846152da4ef939;hb=0c65f3d6df4a89e41ba0ba01e39e35d4848ba5ca;hpb=10801f102209b822c0bf5a802f9c3c50ca40b18c diff --git a/exercises/_assignment8.mdwn b/exercises/_assignment8.mdwn index cd1dc089..a05707ac 100644 --- a/exercises/_assignment8.mdwn +++ b/exercises/_assignment8.mdwn @@ -11,7 +11,7 @@ relationships, as in See her 1999 paper for details. Here is [[code for the simple arithmetic reader monad discussed in the -lecture notes|code/arithmetic1.ml]]. It computes +lecture notes|code/arith1.ml]]. It computes `\x. (+ 1 (* (/ 6 x) 4))`. Your task is to modify it to compute `\x\y.(+ 1 (* (/ 6 x) y))`. You will need to modify five lines. The first one is the type of a boxed int. Instead of `type num = int @@ -44,3 +44,8 @@ When you have it working, try # match eval t2 with Leaf (Num f) -> f g;; - : int = 13 +3. Add in the maybe monad. Start here: + + type num = env -> int option + + Show that your code handles division by zero gracefully.