foundation-0.0.3: Alternative prelude with batteries and no dependencies

License | BSD-style
Maintainer | Vincent Hanquez <vincent@snarc.org>
Stability | experimental
Portability | portable
Safe Haskell | None
Language | Haskell2010

Foundation.IO.FileMap

Description

Note that the memory mapping is handled by the system, not at the haskell level. The system can modify the content of the memory as any moment under your feet.

It also have the limitation of your system, no emulation or nice handling of all those corners cases is attempted here.

for example mapping a large file (> 4G), on a 32 bits system is likely to just fail or returns inconsistent result.

In doubt, use `readFile` or other simple routine that brings the content of the file in IO.

Synopsis

- fileMapRead :: FilePath -> IO (UArray Word8)
- fileMapReadWith :: FilePath -> (UArray Word8 -> IO a) -> IO a

# Documentation

fileMapRead :: FilePath -> IO (UArray Word8) #

Map in memory the whole content of a file.

Once the array goes out of scope, the memory get (eventually) unmap

fileMapReadWith :: FilePath -> (UArray Word8 -> IO a) -> IO a #

Map in memory the whole content of a file,