Completed the solver in haskell. It is not very efficient.