[Haskell-cafe] two problems with Data.Binary and Data.ByteString

Bryan O'Sullivan bos at serpentine.com
Tue Aug 12 20:45:19 EDT 2008

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.

More information about the Haskell-Cafe mailing list