| Maintainer | John Goerzen, |
|---|---|
| Safe Haskell | None |
Python.Objects.File
Contents
Description
Maintainer : jgoerzen@complete.org Stability : provisional Portability: portable
Python file-like objects
Written by John Goerzen, jgoerzen@complete.org
This module provides a Haskell interface to work with Python file-like objects. The Haskell interface is a System.IO.HVIO interface, which is similar in concept to the Python file-like object system.
You can create such objects by using openPyFile from this module, or
openGz or openBz2.
Functions that you can use to operate on these objects are defined at System.IO.HVIO.
PyFile Objects
The basic type for a Python file or file-like object.
PyFiles are a member of System.IO.HVIO and can be used as any other
Haskell HVFS object such as a Handle.
PyFile objects cannot reliably detect EOF when asked by vIsEOF, but
can detect it and raise the appropriate IOError when it is reached.
Also, PyFile objects cannot determine if they are readable, writable,
or seekable in advance.
pyfwrap :: PyFile -> (PyObject -> IO a) -> IO aSource
Wrap an operation, raising exceptions in the IO monad as appropriate.
openModeConv :: IOMode -> [Char]Source
Convert a Haskell open mode to a Python mode string