createPipe calls pipe to create a pipe and returns a pair of
Fds, the first for reading and the second for writing.

dup :: Fd -> IO Fd

dup fd calls dup to duplicate Fdfd to
another Fd.

dupTo :: Fd -> Fd -> IO ()

dupTo src dst calls dup2 to duplicate Fdsrc to Fddst.

fdClose :: Fd -> IO ()

fdClose fd calls close to close Fdfd.

fdRead :: Fd -> ByteCount -> IO (String, ByteCount)

fdRead fd nbytes calls read to read at most nbytes
bytes from Fdfd, and returns the result as a string
paired with the number of bytes actually read.

The operation may fail with:

EOF

End of file has been reached.

SystemError

Various other causes.

fdWrite :: Fd -> String -> IO ByteCount

fdWrite fd s calls write to write
the string s to Fdfd as a
contiguous sequence of bytes. It returns the number of bytes successfully
written.

queryFdOption :: FdOption -> Fd -> IO Bool

getFdOption opt fd calls fcntl to determine whether or
not the flag associated with FdOptionopt is set for
Fdfd.

setFdOption :: Fd -> FdOption -> Bool -> IO ()

setFdOption fd opt val calls fcntl to set the flag
associated with FdOptionopt on Fdfd to
val.

getLock :: Fd -> FileLock -> IO (Maybe (ProcessID, FileLock))

getLock fd lock calls fcntl to get the first FileLock
for Fdfd which blocks the FileLocklock. If
no such FileLock exists, getLock returns Nothing.
Otherwise, it returns Just (pid, block), where block is the
blocking FileLock and pid is the ProcessID of the
process holding the blocking FileLock.

setLock :: Fd -> FileLock -> IO ()

setLock fd lock calls fcntl with F_SETLK to set or
clear a lock segment for Fdfd as indicated by the
FileLocklock. setLock does not block, but fails with
SystemError if the request cannot be satisfied immediately.

waitToSetLock :: Fd -> FileLock -> IO ()

waitToSetLock fd lock calls fcntl with F_SETLKW to set
or clear a lock segment for Fdfd as indicated by the
FileLocklock. If the request cannot be satisfied
immediately, waitToSetLock blocks until the request can be
satisfied.

fdSeek :: Fd -> SeekMode -> FileOffset -> IO FileOffset

fdSeek fd whence offset calls lseek to position the
Fdfd at the given offset from the starting location
indicated by whence. It returns the resulting offset from the
start of the file in bytes.