djb's redo implimentation in haskell