5 Oct
2005
5 Oct
'05
3:01 p.m.
On 05 October 2005 15:46, Ross Paterson wrote:
On Wed, Oct 05, 2005 at 03:22:29PM +0100, Simon Marlow wrote:
Also, GHC's optimiser currently treats (_|_ :: IO a) and (do _|_; return ()) as interchangeable, which is naughty, and people have occasionally noticed, but the benefits can sometimes be huge.
What's wrong with identifying them? You're not expecting the monad laws to hold, are you?
No, of course I don't expect the monad laws to hold :) But the intended meaning of (do _|_; return () :: IO ()) `seq` True is True, not _|_, right? This isn't made explicit in the report, but it's how we all understand the IO monad to work, and perhaps derives from the well-known implementation of (IO a) as (World -> (a,World)). Cheers, Simon