module Save ( save
            , retrieve 
            ) where

import Core
import Binary
import Data.Binary
import qualified Data.ByteString.Lazy as L
import Control.Applicative ((<$>))

save :: FilePath -> IRCState -> IO ()
save fp = L.writeFile fp . encode

retrieve :: FilePath -> IO IRCState
retrieve fp = decode <$> L.readFile fp

module Save ( save
            , retrieve 
            ) where

import Core
import Binary
import Data.Binary
import qualified Data.ByteString.Lazy as L
import qualified Data.ByteString as B
import Control.Applicative ((<$>))

save :: FilePath -> IRCState -> IO ()
save fp = B.writeFile fp . L.toStrict . encode

retrieve :: FilePath -> IO IRCState
retrieve fp = decode . L.fromStrict <$> B.readFile fp

Use strict file writing for saving
Use strict file writing for saving

This prevents us from trying to write to the save file while we are
reading it.
