Huffman encoding in the Haskell type system