docs for System.Posix.IO

Andrew Pimlott andrew at pimlott.net
Wed Jul 6 18:15:45 EDT 2005


On Wed, Jul 06, 2005 at 03:00:18PM -0700, Isaac Jones wrote:
> +-- |Open and optionally create this file.  See 'System.Posix.Files'
> +-- for information on how to use the 'FileMode' type.
>  openFd :: FilePath
>         -> OpenMode
> -       -> Maybe FileMode -- Just x => O_CREAT, Nothing => must exist
> +       -> Maybe FileMode -- ^Just x => creates the file with the given modes, Nothing => the file must exist.

I believe the FileMode is modified by umask, so the file is not
generally created with that mode.  You might add, "to use the user's
default, pass 0o666".

> -fdRead :: Fd -> ByteCount -> IO (String, ByteCount)
> +-- | May throw an exception if this is an invalid descriptor.
> +fdRead :: Fd
> +       -> ByteCount -- ^How many bytes to read
> +       -> IO (String, ByteCount) -- ^The bytes read, how many bytes were read.

Add that eof raises an exception rather than returning an empty string.

Andrew


More information about the Libraries mailing list