How do I call mmap() in Haskell?

David Roundy droundy at abridgegame.org
Thu Dec 2 06:47:32 EST 2004


On Thu, Dec 02, 2004 at 01:16:31AM -0800, William Lee Irwin III wrote:
> I've been wondering how to do mmap() in Haskell since I don't know how
> to get things to interact with the runtime system etc.
> 
> Actually, similar questions apply to asynchronous IO.
> 
> The foreign function interface is nice and all, but modelling the
> result with types and interoperating with the runtime system is the
> real question here.

You could take a look at FastPackedString.hs in darcs, which calls mmap to
read strings, and uses ForeignPtrs to hold their data, so you don't have to
copy the memory over.
-- 
David Roundy
http://www.darcs.net


More information about the Glasgow-haskell-users mailing list