Paste number 30002: YAHT monad laws

Index of paste annotations: 1

Paste number 30002: YAHT monad laws
Pasted by: dino-
When:7 years, 11 months ago
Share:Tweet this! | http://paste.lisp.org/+N5E
Channel:#haskell
Paste contents:
Raw Source | XML | Display As
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:7 years, 11 months ago
Share:Tweet this! | http://paste.lisp.org/+N5E/1
Paste contents:
Raw Source | Display As
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

Colorize as:
Show Line Numbers

Lisppaste pastes can be made by anyone at any time. Imagine a fearsomely comprehensive disclaimer of liability. Now fear, comprehensively.