Hello Bryan,
Saturday, July 22, 2006, 4:40:58 AM, you wrote:
> Forgive me for not understanding, but I was hoping you would explain a
> choice you made in your code. Why did you define foreach and then use
>> foreach [1..n] (\x -> modifySTRef r (*x))
> Instead of simply using
>> mapM_ (\x -> mo
| ps: you successfully going through all the standard Haskell troubles
in
| this area :) seems that making FAQ about using ST monad will be a
| good idea :)
Indeed. If someone would like to start one, a good place for it would be
GHC's collaborative-documentation Wiki
http://haskell.org/
Chad Scherrer wrote:
> 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 tha
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
Hello Chad,
Thursday, July 20, 2006, 9:38:43 PM, you wrote:
> I suppose the same holds for runSTUArray, right? But this still gives
> me that same error, about being less polymorphic than expected.
there is well-known problem with that _unboxed_ arrays aren't
polymorphic. Oleg Kiselyov proposed