ContentsIndex
Python.Objects.File
Portability portable
Stability provisional
Maintainer jgoerzen@complete.org
Contents
PyFile Objects
Description

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 MissingH.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 MissingH.IO.HVIO.

Synopsis
data PyFile
mkPyFile :: PyObject -> PyFile
fromPyFile :: PyFile -> PyObject
openPyFile :: FilePath -> IOMode -> IO PyFile
pyfwrap :: PyFile -> (PyObject -> IO a) -> IO a
PyFile Objects
data PyFile

The basic type for a Python file or file-like object.

PyFiles are a member of MissingH.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.

Instances
Show PyFile
HVIO PyFile
mkPyFile :: PyObject -> PyFile
Takes a PyObject representing a Python file or file-like object and makes it into a PyFile.
fromPyFile :: PyFile -> PyObject
Extracts the PyObject representing this PyFile.
openPyFile :: FilePath -> IOMode -> IO PyFile
Open a file on disk and return a PyFile.
pyfwrap :: PyFile -> (PyObject -> IO a) -> IO a
Wrap an operation, raising exceptions in the IO monad as appropriate.
Produced by Haddock version 0.6