> Simon Marlow <[EMAIL PROTECTED]> writes:
>
> > > So, the question is, "Should readFile on a directory throw an IO
> > > error?" If so, then there is a bug in Hugs; if not,
> there is a bug
> > > (or at least a severe misfeature) in Green Card (and a
> bug in the ghc
> > > libraries, which do throw an IO error).
> >
> > I rather think that openning a directory fail, because
> attempting to perform
> > any other operations on that directory (such as reading
> from it) will fail
> > anyway, and we have the Directory module for dealing with
> directories.
>
> The function readFile takes a filename and returns the contents of
> that file; there's no seperate "open" to fail.
Sure, but readFile is just:
readFile :: FilePath -> IO String
readFile name = openFile name ReadMode >>= hGetContents
and it should behaves exactly as if it is defined this way.
Cheers,
Simon