Huffman trees text encoding realisation via scala case classes and FP