a simple compression algorithm written in haskell