problem solution on haskell with diagrams