Hello, On Sat, May 3, 2008 at 3:56 AM, apfelmus <[EMAIL PROTECTED]> wrote: > Bryan Donlan wrote: > > > > > evaluate x = (return $! x) >>= return > > > > However, if >>= is strict on its first argument, then this definition is > > no better than (return $! x). > > > > According to the monad law > > f >>= return = f > > every (>>=) ought to be strict in its first argument, so it indeed seems > that the implementation given in the documentation is wrong.
>From the monad law we can conclude only that "(>>= return)" is strict, not (>>=) in general. For example, (>>=) for the reader monad is not strict in its first argument: m >>= f = \r -> f (m r) r So, "(undefined >> return 2) = (return 2)" -Iavor _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe