AW: Newbie qustion about monads

Marcin 'Qrczak' Kowalczyk qrczak at
Thu Oct 2 15:47:15 EDT 2003

W liście z czw, 02-10-2003, godz. 14:25, Juanma Barranquero pisze:

> Yeah, I know. But it's difficult to ensure I'm satisfying the laws when
> I'm not entirely sure what do they ask from me...

1. (return x) >>= f == f x
2. m >>= return == m
3. (m >>= f) >>= g == m >>= (\x -> f x >>= g)

My intuition:
1 & 2. return doesn't do anything (except having the given result).
   If added before or after an action, it doesn't change its effect.
3. (>>=) is associative, so it must not leave trails of where it was
   applied, it only propagates effects of the arguments being composed.

   __("<         Marcin Kowalczyk
   \__/       qrczak at

More information about the Haskell-Cafe mailing list