[Haskell-cafe] Examples of using STUArray + help with converting code

Tomasz Zielonka tomasz.zielonka at gmail.com
Thu Oct 13 14:09:56 EDT 2005


On 10/13/05, joel reymont <joelr1 at gmail.com> wrote:
> Folks,
>
> Are there any examples on using STUArray and friends? I'm trying to
> convert the following bit of code which uses deprecated features.
>
> I don't understand the syntax needed to create a new double or float
> array with newArray from Data.Array.MArray.

do arr  <- newArray_ (1,2) :: ST s (STUArray s Int Double)
   writeArray arr 1 d
   ...

The type signature is to remove the ambiguity in type-class
constraints.

> I also don't yet
> understand how to cast that double array to read ints from it.

Don't.

Best regards
Tomasz


More information about the Haskell-Cafe mailing list