Huffman encoding and decoding project, getting used to functional programming