projects
/
lambda.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
add comment about The Little Schemer
[lambda.git]
/
_rosetta2.mdwn
diff --git
a/_rosetta2.mdwn
b/_rosetta2.mdwn
index
48ac277
..
d423609
100644
(file)
--- a/
_rosetta2.mdwn
+++ b/
_rosetta2.mdwn
@@
-463,7
+463,7
@@
The syntax for declaring and using these is a little bit different in the two la
type color = Color of (int * int * int);;
let c = Color (0, 127, 255);;
type color = Color of (int * int * int);;
let c = Color (0, 127, 255);;
-
+
and then extract the field you want using pattern-matching:
let Color (r, _, _) = c;;
and then extract the field you want using pattern-matching:
let Color (r, _, _) = c;;
@@
-717,13
+717,13
@@
Haskell has more built-in support for monads, but one can define the monads one
main = do
let s = "hello world"
putStrLn s
main = do
let s = "hello world"
putStrLn s
-
+
main :: IO String
main = do
let s = "hello world"
putStrLn s
return s
main :: IO String
main = do
let s = "hello world"
putStrLn s
return s
-
+
main :: IO String
main = let s = "hello world"
in putStrLn s >> return s
main :: IO String
main = let s = "hello world"
in putStrLn s >> return s