* All About Monads has supposedly also been integrated into the Haskell wikibook
* (A not-so-)[Gentle Introduction to Haskell](http://web.archive.org/web/http://www.haskell.org/tutorial/) (archived)
* [Learn You a Haskell for Great Good](http://learnyouahaskell.com/)
-
+* [Another page comparing Haskell and OCaml](http://blog.ezyang.com/2010/10/ocaml-for-haskellers/)
##Type expressions##
In OCaml:
- let { red = r; green = g } = c
+ let { red = r; green = g; _ } = c
in r
In Haskell:
In OCaml it's:
- # let makegray ({red = r} as c) = { c with green=r; blue=r };;
+ # let makegray ({ red = r; _ } as c) = { c with green=r; blue=r };;
val makegray : color -> color = <fun>
# makegray { red = 0; green = 127; blue = 255 };;
- : color = {red = 0; green = 0; blue = 0}
and then extract the field you want using pattern-matching:
- let Color(r,_,_) = c;;
+ let Color (r, _, _) = c;;
(* or *)
- match c with Color(r,_,_) -> ...
+ match c with Color (r, _, _) -> ...
(Or you could just use bare tuples, without the `Color` data constructor.)