projects
/
lambda.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
0a621c3
)
edits
author
Chris Barker
<barker@kappa.linguistics.fas.nyu.edu>
Mon, 1 Nov 2010 14:26:20 +0000
(10:26 -0400)
committer
Chris Barker
<barker@kappa.linguistics.fas.nyu.edu>
Mon, 1 Nov 2010 14:26:20 +0000
(10:26 -0400)
week7.mdwn
patch
|
blob
|
history
diff --git
a/week7.mdwn
b/week7.mdwn
index
8daff8a
..
fe9bedb
100644
(file)
--- a/
week7.mdwn
+++ b/
week7.mdwn
@@
-367,7
+367,7
@@
them from hurting the people that use them or themselves.
* **Left identity: unit is a left identity for the bind operation.**
That is, for all `f:'a -> 'a m`, where `'a m` is a monadic
* **Left identity: unit is a left identity for the bind operation.**
That is, for all `f:'a -> 'a m`, where `'a m` is a monadic
- type, we have `(unit x)
*
f == f x`. For instance, `unit` is itself
+ type, we have `(unit x)
>>=
f == f x`. For instance, `unit` is itself
a function of type `'a -> 'a m`, so we can use it for `f`:
# let unit x = Some x;;
a function of type `'a -> 'a m`, so we can use it for `f`:
# let unit x = Some x;;
@@
-377,8
+377,8
@@
them from hurting the people that use them or themselves.
The parentheses is the magic for telling OCaml that the
function to be defined (in this case, the name of the function
The parentheses is the magic for telling OCaml that the
function to be defined (in this case, the name of the function
- is `
*
`, pronounced "bind") is an infix operator, so we write
- `u
* f` or `( * ) u f` instead of `*
u f`. Now:
+ is `
>>=
`, pronounced "bind") is an infix operator, so we write
+ `u
>>= f` or equivalently `( >>= ) u f` instead of `>>=
u f`. Now:
# unit 2;;
- : int option = Some 2
# unit 2;;
- : int option = Some 2