solving haskell exercise of second day on 7l7w