X-Git-Url: http://lambda.jimpryor.net/git/gitweb.cgi?p=lambda.git;a=blobdiff_plain;f=assignment6.mdwn;h=a31cbf8a8b2ac51ea3a27701892f37d6be423db9;hp=853403db7ad988b87e491db062a25885dbf8dfdc;hb=fa7c5a7f1232f472a5cda6c48450fd76fbf9f03a;hpb=a92bbc12c3537a886f85ae063d5f77adfdb325d3
diff --git a/assignment6.mdwn b/assignment6.mdwn
index 853403db..a31cbf8a 100644
--- a/assignment6.mdwn
+++ b/assignment6.mdwn
@@ -1,18 +1,18 @@
-1. **Build a state monad.** Based on the division by zero monad,
+1. **Build a State monad.** Based on the division by zero monad,
build a system that will evaluate arithmetic expressions. Instead of
returning a simple integer as a result, it will deliver the correct
answer along with a count of the number of operations performed during
the calculation. That is, the desired behavior should be like this:
- # lift ( + ) (lift ( / ) (unit 20) (unit 2))
- (lift ( * ) (unit 2) (unit 3)) 0;;
+ # lift2 ( + ) (lift2 ( / ) (unit 20) (unit 2))
+ (lift2 ( * ) (unit 2) (unit 3)) 0;;
- : int * int = (16, 3)
- Here, `lift` is the function that uses `bind` to prepare an ordinary
+ Here, `lift2` is the function that uses `bind` to prepare an ordinary
arithmetic operator (such as addition `( + )`, division `( / )`, or
multiplication `( * )`) to recieve objects from the counting monad as
arguments. The response of the interpreter says two things: that
-(20/2) + (2*3) = 16, and that the computation took three arithmetic
+(20/2) + (2\*3) = 16, and that the computation took three arithmetic
steps. By the way, that zero at the end provides the monadic object
with a starting point (0 relevant computations have occurred previous
to the current computation).
@@ -21,8 +21,11 @@ to the current computation).
divide by zero (so there should be no int option types anywhere in
your solution).
- You'll need to define a computation monad type, unit, bind, and lift.
-We encourage you to consider this hint: [[Assignment 6 Hint 1]].
+ You'll need to define a computation monad type, unit, bind, and lift2.
+We encourage you to consider this hint: [[hints/Assignment 6 Hint 1]].
+
+ See our [commentary](/hints/assignment_6_commentary) on your solutions.
+
2. Prove that your monad satisfies the monad laws. First, give
examples illustrating specific cases in which the monad laws are