X-Git-Url: http://lambda.jimpryor.net/git/gitweb.cgi?p=lambda.git;a=blobdiff_plain;f=rosetta2.mdwn;h=d4b6a025079b29a2bd2f6c616b62bff941007a79;hp=c37f222812e3d31e43415583ba7ad8c406f31ed0;hb=72788c7619ea1ef4af5e9ace1e2fc4b2fde79671;hpb=bd85b1b814509644125eee197e6111584151b3d1 diff --git a/rosetta2.mdwn b/rosetta2.mdwn index c37f2228..d4b6a025 100644 --- a/rosetta2.mdwn +++ b/rosetta2.mdwn @@ -1,5 +1,20 @@ ## More detailed differences between Scheme, OCaml, and Haskell ## -*Will add this later, as we learn more concepts.* +Here is comparison of the syntax for declaring types in Haskell and OCaml: + -- Haskell + data Pretty a b = Lovely a | Cute b ClothingModule.ButtonType + newtype Pretty a b = Pretty a b Int + newtype Pretty a b = Pretty { unPretty a } + type Pretty a b = (a, b) + (* OCaml *) + type ('a,'b) pretty = Lovely of 'a | Cute of 'b * ClothingModule.ButtonType + type ('a,'b) pretty = Pretty of 'a * 'b * int + type ('a,'b) pretty = Pretty of 'a + type ('a,'b) pretty = 'a * 'b + + +*Will explain later, and add more material.* + +Until we do, have a look at our [page on translating between OCaml Scheme and Haskell](http://lambda1.jimpryor.net/translating_between_OCaml_Scheme_and_Haskell) from the first time we offered this seminar.