[Haskell] strictness of putChar: report incomplete?

Malcolm Wallace Malcolm.Wallace at cs.york.ac.uk
Tue Oct 4 08:27:07 EDT 2005

John Meacham <john at repetae.net> writes:

> ghc:
> putChar _|_ -> _|_
> putStr _|_ -> valid IO ()
> hugs:
> putChar _|_ -> valid IO ()
> putStr _|_ -> valid IO () 

I think it comes down to buffering behaviour doesn't it?  Should the
character be evaluated when it is added to the output buffer, or when
the output buffer is flushed to its destination?  It would seem that
ghc has an array of true unboxed characters for the buffer, whilst
hugs has an array of boxed chars.

> I believe the hugs behavior is correct and ghc and jhc are wrong, but
> there were differing opinions on #haskell.

Wouldn't that impose an unnecessarily burdensome implementation choice?

If the Report is silent, then either choice would be permissible.
However, I'm inclined to the view that where the Prelude refers to
a primitive operation (e.g. primPutChar), that all prims are strict,
since by implication they are not implementable in Haskell.


More information about the Haskell mailing list