[Haskell] Constraint Satisfaction Problem