[Haskell-cafe] More STUArray questions
Chris Kuklewicz
haskell at list.mightyreason.com
Sun Mar 12 15:51:57 EST 2006
Martin Percossi wrote:
> On Sun, Mar 12, 2006 at 10:37:45PM +0300, Bulat Ziganshin wrote:
>> runSTMatrix :: ST s (MMatrix s) -> Matrix
>>
>> runSTMatrix a = runST ( do (MMatrix i j mblock) <- a
>> block <- unsafeFreeze mblock
>> return (Matrix i j block)
>> )
There is a small error in the type of runSTMatrix, see below
>
> I tried this implementation, but I still get an error message, which
> looks quite similar to my previous implementations' errors:
>
> matrix.hs:138:27:
> Couldn't match the rigid variable `s' against the rigid variable `s1'
> `s' is bound by the polymorphic type `forall s. ST s a'
> at matrix.hs:(138,16)-(141,22)
> `s1' is bound by the type signature for `runSTMatrix'
> Expected type: ST s
> Inferred type: ST s1
> In a 'do' expression: (MMatrix i j mblock) <- a
> In the first argument of `runST', namely
> `(do
> (MMatrix i j mblock) <- a
> block <- unsafeFreeze mblock
> return (Matrix i j block))'
>
runSTMatrix :: (forall s. ST s (MMatrix s)) -> Matrix
runSTMatrix a = runST ( do (MMatrix i j mblock) <- a
block <- unsafeFreeze mblock
return (Matrix i j block)
)
More information about the Haskell-Cafe
mailing list