Types and Pattern Matching - huffman encoding