add a Haskell solution

As per disucssion on Twitter and https://gist.github.com/masak/8918fee408cf8368e405