
11 Nov
2008
11 Nov
'08
2:28 p.m.
chad.scherrer:
Hello cafe,
I've hit a bit of a monadic snag here...
I'm scanning a big file, building a table of statistics. I end up with something like
IO (IntMap (IOUArray Int Double))
Once I've read in the whole file and built my statistics, I don't need any more updates, so I'd like to do something like
IntMap (IOUArray Int Double) -> IO (IntMap (UArray Int Double)),
using unsafeFreeze. I'm getting stuck here, since the IntMap library is not so monad-friendly.
Hmm. So you'd need to construct a new IntMap, made by fmap'ping unsafeFreeze over each element of the old map. -- Don