import Codec.Binary.UTF8.String hiding (encode, decode)
import Control.Applicative
-import Data.Array
import Data.Binary
import Data.Binary.Put
import qualified Data.ByteString.Lazy as B
-import Data.Word
import Data.Char
import Data.String
import qualified Data.Set as S
toString :: B.ByteString -> String
toString bstr = decodeString $ map (chr . fromIntegral) $ B.unpack bstr
+toCharList :: B.ByteString -> [Int]
+toCharList bstr = map fromIntegral $ B.unpack bstr
+
-- | Constant pool
-type Pool = Array Word16 Constant
+type Pool = M.Map Word16 Constant
+
+poolSize :: Pool -> Int
+poolSize = M.size
-asize :: (Ix i) => Array i e -> Int
-asize = length . elems
+(!) :: (Ord k) => M.Map k a -> k -> a
+(!) = (M.!)
showListIx :: (Show a) => [a] -> String
showListIx list = unlines $ zipWith s [1..] list