safer-file-handles-0.9: Type-safe file handling

MaintainerBas van Dijk <v.dijk.bas@gmail.com>

System.IO.SaferFileHandles.Unsafe

Description

Unsafe functions for retrieving the native Handle from a regional file handle and for lifting operations on Handles to RegionalFileHandles.

These operations are unsafe because they allow you to close regional file handles before exiting their region. So they enable you to perform IO with already closed handles.

Synopsis

Documentation

wrap :: MonadIO m => (Handle ioMode -> IO α) -> RegionalFileHandle ioMode r -> m αSource

wrap2 :: MonadIO m => (Handle ioMode -> β -> IO α) -> RegionalFileHandle ioMode r -> β -> m αSource

wrap3 :: MonadIO m => (Handle ioMode -> γ -> β -> IO α) -> RegionalFileHandle ioMode r -> γ -> β -> m αSource

sanitizeIOError :: IO α -> IO αSource

Modify thrown IOErrors in the given computation by erasing the ioe_handle field in the IOError which may contain the Handle which caused the IOError.

I use this to ensure that Handles don't leak out the region via exceptions.