[Haskell-cafe] Getting my mind around UArray -> STUArray
conversion
Dan Doel
dan.doel at gmail.com
Fri Jun 19 22:08:29 EDT 2009
Oops, I replied too hastily.
What I wrote in my first mail is a problem, as witnessed by the "ix" and "ix1"
in the error message. However, it isn't the main error. The main error is that
you have a monadic expression, with type something like:
ST s (UArray ix e)
but the return type of your function is:
UArray ix e
To make a no-op you need to add a runST, something like:
runST (unsafeThaw mem >>= unsafeFreeze)
If you need to annotate 'unsafeThaw mem', that's where the ScopedTypeVariables
will come in. However, there's also an issue that mentioning 's' in the type
of wombat won't work with the runST, which may be a problem with the MArray
constraint (and I'm not sure what to do about that off the top of my head;
I've not worked with STUArray in a while, so you may be constructing an
unresolvable ambiguity).
Sorry for the confusion.
-- Dan
More information about the Haskell-Cafe
mailing list