solution to diabolo in haskell