Memory mapped files strict interface

The mmapFilePtr function maps a file or device into memory,
returning a tripple containing pointer that accesses the mapped file,
the finalizer to run to unmap region and size of mmaped memory.

If the mmap fails for some reason, an error is thrown.

Memory mapped files will behave as if they were read lazily --
pages from the file will be loaded into memory on demand.

The storage manager is used to free the mapped memory. When
the garbage collector notices there are no further references to the
mapped memory, a call to munmap is made. It is not necessary to do
this yourself. In tight memory situations, it may be profitable to
use System.Mem.performGC or finalizeForeignPtr to force an unmap.

File must be created with correct attributes prior to mapping it
into memory.

If mode is ReadWrite or WriteCopy, the returned memory region may
be written to with Foreign.Storable.poke and friends.

Range specified may be Nothing, then whole file is mapped. Otherwise
range should be 'Just (offset,size)' where offsets is the beginning byte
of file region to map and size tells its length. There are no alignment
requirements.

If range to map extends beyond end of file, it will be resized accordingly.

The mmapFilePtrLazy function maps a file or device into memory,
returning a list of tripples containing pointer that accesses the mapped file,
the finalizer to run to unmap that region and size of mapped memory.

If the mmap fails for some reason, an error is thrown.

Memory mapped files will behave as if they were read lazily --
pages from the file will be loaded into memory on demand.

The storage manager is used to free the mapped memory. When
the garbage collector notices there are no further references to the
mapped memory, a call to munmap is made. It is not necessary to do
this yourself. In tight memory situations, it may be profitable to
use System.Mem.performGC or finalizeForeignPtr to force an unmap.

File must be created with correct attributes prior to mapping it
into memory.

If mode is ReadWrite or WriteCopy, the returned memory region may
be written to with Foreign.Storable.poke and friends.

Range specified may be Nothing, then whole file is mapped. Otherwise
range should be 'Just (offset,size)' where offsets is the beginning byte
of file region to map and size tells its length. There are no alignment
requirements.

If range to map extends beyond end of file, it will be resized accordingly.

Maps region of file and returns it as Data.ByteString.Lazy.ByteString.
File is mapped in in ReadOnly mode. See mmapFilePtrLazy for details.
Chunks are mapped in on demand.

Note: this operation may break referential transparency! If
any other process on the system changes the file when it is mapped
into Haskell, the contents of your Data.ByteString.Lazy.ByteString may change.