packages feed

every-bit-counts-0.1: Main.hs

module Main where 

import System
import Games
import Huffman
import Data.List 
import Data.Char

-- Silly experiment 
main :: IO () 
main = do { (fn:_) <- getArgs 
          ; contents <- readFile fn
          ; let minc = minimumBy compare contents
                maxc = maximumBy compare contents 
                chars = map (\c -> (1,chr c)) [(ord minc)..(ord maxc)]
          ; let bitstring = enc (dHuffGame' chars) contents
          ; putStrLn $ "Bytes needed: " ++ (show $ (length bitstring) `div` 8)
          }