Hi,

The short answer: use
        runST (long expression)
rather than
        runST $ long expression

when it comes to higher-ranked functions such as runST.

I suppose the same holds for runSTUArray, right? But this still gives
me that same error, about being less polymorphic than expected.

(+=) x y = let updateX i = do xi <- readArray x i
                             writeArray x i (xi + y!i)
          in  sequence_ . map updateX $ indices x

sumArrays [] = error "Can't apply sumArrays to an empty list"
sumArrays (x:xs) = runSTUArray result
   where
   result = do x0 <- thaw x
               mapM_ (x0 +=) xs
               x0



--

Chad Scherrer

"Time flies like an arrow; fruit flies like a banana" -- Groucho Marx
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to