solving Partial Digest Problem with Haskell