[m-dev.] arrays (was: stream I/O)

Fergus Henderson fjh at cs.mu.OZ.AU
Tue Oct 3 21:43:12 AEDT 2000


On 03-Oct-2000, Ralph Becket <rbeck at microsoft.com> wrote:
> [Slight misgiving: I'd like to see read_stream_as_array in 
> there (with optimizations in array.m to handle char types efficiently)
> since one can't do in-place manipulation of strings.]

The latest version of ghc has an interesting design for how it handles
arrays.  See <http://www.haskell.org/ghc/docs/latest/set/sec-marray.html>.
They have a bunch of different array types, including unboxed arrays
of the various primitive types such as Char and Int, as well as
ordinary polymorphic arrays.  But the interface to all these different
array types is via a single type class `MArray'.

(In fact since they don't have unique modes, they need to handle
mutable arrays using monads, and depending on the occaision you may
want to use either the I/O monad or a state monad.  So they also
parameterize their array class on the monad.  For Mercury, we wouldn't
want to do that.)

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3        |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list