On Tue, 12 Aug 2008, Bryan O'Sullivan wrote:

On Tue, Aug 12, 2008 at 5:34 PM, Tim Newsham <[EMAIL PROTECTED]> wrote:

I tried to force the data with:

   loadState db = do
       d <- decode <$> B.readFile stateFile
       let force = sum $ M.elems $ M.size `fmap` d
       force `seq` atomically $ writeTVar db d

and I get the same error when trying to writeFile after doing
a loadState.

What happens if you simply print the number of elements in the map?
Forcing its spine is all you should need.

This is what the sum above does.  Its a Map of Maps, so this maps
M.size over the outter Map and sums the resulting elements.
That should touch every map element, at least.

Tim Newsham
http://www.thenewsh.com/~newsham/
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to