Ok, I see now why the return is necessary. For now I'll switch to
boxed arrays until I get the rest of this down better.

But why should this...

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

work differently than this...

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

Are the types of (result x) and result' not exactly the same?


--

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