From: jim Date: Mon, 6 Apr 2015 09:22:37 +0000 (-0400) Subject: capitalization and type declaration syntax X-Git-Url: http://lambda.jimpryor.net/git/gitweb.cgi?p=lambda.git;a=commitdiff_plain;h=bfcd8f25d74a83d57e340232944e2445be68a832;hp=304acaf16c06ed0fda1085f2a6689f92a8e635be capitalization and type declaration syntax --- diff --git a/rosetta2.mdwn b/rosetta2.mdwn index c37f2228..ab2de7d6 100644 --- a/rosetta2.mdwn +++ b/rosetta2.mdwn @@ -1,5 +1,19 @@ ## 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.*