[Haskell] strictness of putChar: report incomplete?

Simon Marlow simonmar at microsoft.com
Wed Oct 5 11:01:09 EDT 2005


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


More information about the Haskell mailing list