« Return to Thread: Control.Exception.evaluate - 'correct definition' not so correct

Re: Control.Exception.evaluate - 'correct definition' not so correct

by apfelmus :: Rate this Message:

Reply to Author | View in Thread

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.


Regards,
apfelmus

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@...
http://www.haskell.org/mailman/listinfo/haskell-cafe

 « Return to Thread: Control.Exception.evaluate - 'correct definition' not so correct

LightInTheBox - Buy quality products at wholesale price