-------------------------------------------------------------------------
--                              
--         MakeCode.hs                          
--                              
--         Huffman coding in Haskell.                   
--                              
--         (c) Addison-Wesley, 1996-2011.                   
--                          
-------------------------------------------------------------------------

module MakeCode ( codes, codeTable ) where

import Types
import Frequency ( frequency )
import MakeTree  ( makeTree )
import CodeTable ( codeTable )

-- Putting together frequency calculation and tree conversion   

codes :: [Char] -> Tree

codes :: [Char] -> Tree
codes = [(Char, Int)] -> Tree
makeTree ([(Char, Int)] -> Tree)
-> ([Char] -> [(Char, Int)]) -> [Char] -> Tree
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [Char] -> [(Char, Int)]
frequency