A port of Bryan O'Sullivan's attoparsec from Haskell to Scala