| Paste number 30002: | YAHT monad laws |
| Pasted by: | dino- |
| When: | 6 years, 6 months ago |
| Share: | Tweet this! | http://paste.lisp.org/+N5E |
| Channel: | #haskell |
| Paste contents: |
in Yet Another Haskell Tutorial
Chapter 9: Monads, page 124
a discussion of the Monad laws, Law 3 has this example:
law3a = do
x <- f
do g <- x
h y
law3b = do
y <- do x <- f
g x
h y
I'm confused about law3a above, specifically where y is coming from.
Should it be something like this:
law3a = do
x <- f
do y <- g x
h y
Annotations for this paste:
| Annotation number 1: | re: YAHT monad laws |
| Pasted by: | dino- |
| When: | 6 years, 6 months ago |
| Share: | Tweet this! | http://paste.lisp.org/+N5E/1 |
| Paste contents: |
Yes, it should look like this:
law3a = do
x <- f
do y <- g x
h y
I edited this entry to be correct in the YAHT Wikibook here:
http://en.wikibooks.org/wiki/Haskell/YAHT/Monads#Law_3