[Haskell-cafe] Re: Control.Exception.evaluate - 'correct definition' not so correct

Jules Bean jules at jellybean.co.uk
Sat May 3 07:21:40 EDT 2008

apfelmus 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.

But it is known that the monad laws only apply up to some weaker 
equivalence than 'seq-equivalence'.

This has been discussed here countless times by people who understand it 
better than me.

As I understand the summary the "=" sign in the monad laws mean 
"represent identical actions, in terms of the effects produced and the 
result returned". A kind of observational-equivalence for monad 
execution, but weaker than direct equational equivalence in the presence 
of seq.

(Some people view this as more of a bug in "seq" than in the monad laws)


More information about the Haskell-Cafe mailing list