djb's redo implementation in Haskell