[Haskell] strictness of putChar: report incomplete?

Simon Marlow simonmar at microsoft.com
Thu Oct 6 04:51:01 EDT 2005


On 05 October 2005 17:05, Lennart Augustsson wrote:

> Wolfgang Jeltsch wrote:
>> Am Mittwoch, 5. Oktober 2005 16:22 schrieb Simon Marlow:
>> 
>>> [...]
>> 
>> 
>>> 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.  It
>>> is this distinction that makes it hard to optimise IO code in a
>>> Haskell compiler, though. 
>> 
>> 
>> I think, seq should be a method of a type class.  Then we could
>> forbid applying seq to a function, we could forbid applying seq to
>> an IO expression and we could forbid applying seq to expressions of
>> any type with hidden implementation for which we don't want to
>> provide bottom tests. 
> 
> I agree with you.  And that is how it used to be, but then
> some people didn't think that was convenient enough so now
> we are stuck with a seq that (IMHO) stinks. :)

Having a seq that works on anything is occasionally very useful for
fixing space leaks, and the type class version was kind of ugly and
unwieldy.  The type class pops up when you use ! in a data declaration,
which looks strange.  But I agree that polymorphic seq does have some
painful side effects.

Cheers,
	Simon


More information about the Haskell mailing list