solved p5 with haskell