[Haskell-cafe] two problems with Data.Binary and Data.ByteString
newsham at lava.net
Tue Aug 12 20:48:38 EDT 2008
On Tue, 12 Aug 2008, Bryan O'Sullivan wrote:
> On Tue, Aug 12, 2008 at 5:34 PM, Tim Newsham <newsham at lava.net> 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.
More information about the Haskell-Cafe