Re: [Haskell-cafe] Memory-mapped arrays? (IArray interfaces, slices, and so on)
On Wed, Nov 07, 2007 at 10:10:16PM +, Jules Bean wrote: Joel Reymont wrote: Is there such a thing as memory-mapped arrays in GHC? In principle, there could be an IArray instance to memory-mapped files. (There could also be a mutable version, but just the IArray version would be useful). The IArray instance would be unsafe, however, because the contents of the file could change after you opened it, breaking referential transparency. I don't know what all is possible with file open modes, but I don't think you can guarantee that once you've opened a file it won't change (unless you unlink it, and know that noone else has an opened file handle to it). It may be that by opening it in write mode you could ensure that noone else modifies it (although I don't think this would work e.g. on nfs), but then you eliminate the very useful possibility of mmapping read-only files as IArrays (e.g. to access /usr/share/dict/words). So it seems reasonable that the mutable version would necesarily be primary, with the IArray version accessible only by an unsafe operation. -- David Roundy Department of Physics Oregon State University ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Memory-mapped arrays? (IArray interfaces, slices, and so on)
Joel Reymont wrote: Is there such a thing as memory-mapped arrays in GHC? In principle, there could be an IArray instance to memory-mapped files. (There could also be a mutable version, but just the IArray version would be useful). I noticed just the other day that there are some 'obvious' IArray constructors missing. It ought, for example, be possible to build a new IArray from an old from a subset of the elements; a dimensional slice going from an (Int,Int,Int) indexed array to (Int,Int), or a stride taking 'one element in three' along each axis, etc. Annoyingly, it doesn't seem to be straightforward to make your own instances of IArray, since the important methods aren't exported. I think there is real scope for some expansion here. Jules ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Memory-mapped arrays? (IArray interfaces, slices, and so on)
On Wed, Nov 07, 2007 at 10:10:16PM +, Jules Bean wrote: Joel Reymont wrote: Is there such a thing as memory-mapped arrays in GHC? In principle, there could be an IArray instance to memory-mapped files. (There could also be a mutable version, but just the IArray version would be useful). I noticed just the other day that there are some 'obvious' IArray constructors missing. It ought, for example, be possible to build a new IArray from an old from a subset of the elements; a dimensional slice going from an (Int,Int,Int) indexed array to (Int,Int), or a stride taking 'one element in three' along each axis, etc. Annoyingly, it doesn't seem to be straightforward to make your own instances of IArray, since the important methods aren't exported. They are, from the undocumented module Data.Array.Base. Stefan signature.asc Description: Digital signature ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe