A rewrite of glitchr in haskell