RE: MArray and newSTUArray

Excellent idea. This does indeed seem to be the cleanest way to explain the necessary type constraints. I think we (Simon M) may add it to the library. Simon | -----Original Message----- | From: Dean Herington [mailto:heringto@cs.unc.edu] | Sent: 13 February 2003 15:21 | To: haskell-cafe@haskell.org | Subject: MArray and newSTUArray | | The MArray class in Data.Array.MArray is a very nice abstraction. | However, when creating an array whose type partakes of MArray, say | STUArray, I find myself defining and using a type-specific creation | function, such as: | | newSTUArray :: (MArray (STUArray s) e (ST s), Ix i) | => (i, i) -> e -> ST s (STUArray s i e) | newSTUArray = newArray | | so that I don't have to give a complicated type declaration for each use | of `newArray` that creates an STUArray. | | 1. Is there a better (more concise/convenient) way to provide the | necessary type information? | 2. If not, should functions such as `newSTUArray` be provided in the | libraries? | | -- Dean | | _______________________________________________ | Haskell-Cafe mailing list | Haskell-Cafe@haskell.org | http://www.haskell.org/mailman/listinfo/haskell-cafe
participants (1)
-
Simon Peyton-Jones