Added an copy-pasted Haskell-impl for comparison.