X-Git-Url: http://lambda.jimpryor.net/git/gitweb.cgi?p=lambda.git;a=blobdiff_plain;f=exercises%2Fassignment5.mdwn;h=73889482c1999d37564b214af2e9419da50d9d7f;hp=00ede5aaf1ef0ff93018070b18ef3ddc606ba69f;hb=436617710a6cbfdf5a14be46281f20894ae76e50;hpb=6922b3d0f2e4fc3a60bc2a388bac5586156beb9f diff --git a/exercises/assignment5.mdwn b/exercises/assignment5.mdwn index 00ede5aa..73889482 100644 --- a/exercises/assignment5.mdwn +++ b/exercises/assignment5.mdwn @@ -329,9 +329,7 @@ any type `α`, as long as your function is of type `α -> α` and you have a bas -- Or this: let sysf_true = (\y n -> y) :: Sysf_bool a - Note that in both OCaml and the Haskell code, the generalization `∀'a` on the free type variable `'a` is implicit. If you really want to, you can supply it explicitly in Haskell by saying: - - :set -XExplicitForAll + :set -XExplicitForAll let { sysf_true :: forall a. Sysf_bool a; ... } -- or let { sysf_true :: forall a. a -> a -> a; ... } @@ -384,7 +382,7 @@ Yet we haven't given ourselves the capacity to talk about `list [S]` and so on a = λf:T -> S. λxs:list. xs [T] [list [S]] (λx:T. λys:list [S]. cons [S] (f x) ys) (nil [S]) --> -*Update: Never mind, don't bother with the next three questions. They proved to be more difficult to implement in OCaml than we expected. Here is [[some explanation|assignment5 hint3]].* +*Update: Never mind, don't bother with the next three questions. They proved to be more difficult to implement in OCaml than we expected. Here is [[some explanation|assignment5 hint4]].* 19. Convert this list encoding and the `map` function to OCaml or Haskell. Again, call the type `sysf_list`, and the functions `sysf_nil`, `sysf_cons`, and `sysf_map`, to avoid collision with the names for native lists and functions in these languages. (In OCaml and Haskell you *can* say `('t) sysf_list` or `Sysf_list t`.) @@ -408,7 +406,7 @@ Be sure to test your proposals with simple lists. (You'll have to `sysf_cons` up # k 1 true ;; - : int = 1 - If you can't understand how one term can have several types, recall our discussion in this week's notes of "principal types". (WHERE?) + If you can't understand how one term can have several types, recall our discussion in this week's notes of "principal types".