
Am Samstag 20 Juni 2009 03:51:08 schrieb Dan Doel:
On Friday 19 June 2009 9:43:29 pm Scott Michel wrote:
wombat :: (IArray UArray e, Ix ix, MArray (STUArray s) e (ST s)) => e -> ix -> UArray ix e -> UArray ix e wombat val idx mem = (unsafeThaw mem :: ST s (STUArray s ix e)) >>= (\mmem -> unsafeFreeze mmem)
Based on the error message and dealing with this sort of thing before, your problem is that when you say:
":: ST s (STUArray s ix e)"
the s, ix and e there aren't the same as they are in the signature of wombat. To make them the same, you need the ScopedTypeVariables extension, and to make wombat's signature:
wombat :: forall e ix s. ...
where the dots are your current signature.
It's possible you'll still have errors, but that will solve the one in your mail.
-- Dan
No, only part of it. Another part is unsafeFreeze :: (Ix i, MArray a e m, IArray b e) => a i e -> m (b i e) so unsafeThaw arr >>= unsafeFreeze lives in a monad, here (ST s) and to get the type he wants, he has to wrap it in runST.