import Prelude hiding (length, concat)
-import Control.Applicative ((<*))
import Data.ByteString (ByteString, length, concat)
import Data.ByteString.Char8 (unpack, pack)
-import Data.Functor ((<$>))
import Data.Map.Strict (Map, fromList, toList)
import Text.ParserCombinators.Parsec
import qualified Text.Parsec.ByteString as ParsecBS
import Data.ByteString.Lazy (fromStrict, fromChunks, toStrict)
import qualified Data.ByteString.Char8 as BC (replicate, pack)
import Control.Monad (replicateM, liftM)
-import Control.Applicative ((<$>), liftA3)
+import Control.Applicative (liftA3)
import Data.Binary (Binary(..), decode, encode)
import Data.Binary.Put (putWord32be, putWord16be, putWord8)