
20 Jul
2006
20 Jul
'06
4:26 p.m.
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