Canonical Huffman algorithm in Haskell