[Haskell] strictness of putChar: report incomplete?
duncan.coutts at worcester.oxford.ac.uk
Tue Oct 4 09:15:59 EDT 2005
On Tue, 2005-10-04 at 13:46 +0100, Malcolm Wallace wrote:
> I wrote:
> > > ghc:
> > > putChar _|_ -> _|_
> > >
> > > hugs:
> > > putChar _|_ -> valid IO ()
> > I think it comes down to buffering behaviour doesn't it?
> Having reviewed the IRC logs, I see I was talking nonsense.
> You want to be able to store a closure for (putChar undefined) in a
> data structure, which seems like a perfectly reasonable thing to do.
> Provided the IO action is never actually run (after being retrieved
> from the data structure), the program really ought not to crash.
> I see that nhc98 and hbc agree with Hugs on this behaviour, so ghc
> _must_ be wrong. :-)
Looking at GHC's library code we see that it is indeed forcing the char
hPutChar :: Handle -> Char -> IO ()
hPutChar handle c =
c `seq` do
More information about the Haskell