
Hello. I would like to use muttable arrays in Haskell 98, with the GHC _and_ NHC98 compilers. By muttable arrays I mean arrays with in-place updates, as with the MArray arrays (which are not Haskell 98 conformant) found in GHC. Is such array implmentation available? Regards. Romildo -- Prof. José Romildo Malaquias Departamento de Computação http://iceb.ufop.br/~romildo Universidade Federal de Ouro Preto romildo@iceb.ufop.br Brasil romildo@uber.com.br

José Romildo Malaquias
I would like to use muttable arrays in Haskell 98, with the GHC _and_ NHC98 compilers. By muttable arrays I mean arrays with in-place updates, as with the MArray arrays (which are not Haskell 98 conformant) found in GHC. Is such array implmentation available?
Both compilers have libraries supporting the `IOArray' type, implemented with in-place update, although obviously the operations must be threaded through the IO monad. module IOExtras -- called IOExts in ghc ( ... , IOArray -- data IOArray ix elt -- mutable arrays , newIOArray -- :: Ix ix => (ix,ix) -> elt -> IO (IOArray ix elt) , boundsIOArray -- :: Ix ix => IOArray ix elt -> (ix, ix) , readIOArray -- :: Ix ix => IOArray ix elt -> ix -> IO elt , writeIOArray -- :: Ix ix => IOArray ix elt -> ix -> elt -> IO () , freezeIOArray -- :: Ix ix => IOArray ix elt -> IO (Array ix elt) , module Ix -- re-export Ix for the benefit of IOArrays -- instance Eq (IOArray ix elt) ) Regards, Malcolm
participants (2)
-
José Romildo Malaquias
-
Malcolm Wallace