Alastair Reid writes:
>
> I'm getting the same behaviour - but I can't find anything in the library
> report to say what the correct behaviour is.
>
> I vaguely remember being told that a semiclosed handle is supposed to be
> both open and closed (which isn't what Hugs does and isn't what you
> were expecting) - but I can't find anything which says this explicitly.
>
> Does anyone out there know what's supposed to happen?
>
The rationale that came with the Haskell 1.3 I/O proposal had some
stuff about this, as it defined the derived operation `hIsSemiClosed':
hIsSemiClosed :: Handle -> IO Bool
hIsSemiClosed h = hIsOpen h >>= \ ho ->
hIsClosed h >>= \ hc ->
return (not (ho || hc))
i.e., False should be returned for both `hIsOpen' and `hIsClosed'
on semi-closed handles (which is what ghc's implementation of IO
does.)
cf. http://www.dcs.gla.ac.uk/~kh/Haskell1.3/Rationale.html#Properties
--Sigbjorn
>
> > [EMAIL PROTECTED] reports the following problem.
> >
> > Version: 1.4
> > OS: Unix
> > compiler:
> > configuration:
> > Expected behaviour:
> > False <and text>
> > Observed behaviour:
> > True <and text>
> >
> > Transcript:
> > :l IO
> > hGetContents stdin >>= \s -> hIsOpen stdin >>= \b -> putStr (show b ++ s)
> >
> > Code: