Added input/output to Haskell impl.