[Haskell-cafe] mapping unfreeze over an IntMap of IOUArrays
dons at galois.com
Tue Nov 11 14:28:23 EST 2008
> 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.
More information about the Haskell-Cafe