cvs commit: fptools/libraries/base/Data PackedString.hs

Simon Marlow simonmar@glass.cse.ogi.edu
Tue, 15 Apr 2003 03:41:16 -0700


simonmar    2003/04/15 03:41:15 PDT

  Modified files:
    libraries/base/Data  PackedString.hs 
  Log:
  Re-instate joinPS which appears to have been accidentally left out of
  this revised version of PackedString, and add unlinesPS and unwordsPS
  which are the analogs of Data.List.unlines and Data.List.unwords
  respectively.
  
  Fix bug: linesPS doesn't work the same way as Data.List.lines, because
  it strips out empty lines, and it therefore isn't the inverse of
  unlinesPS.  This is because linesPS is defined in terms of splitPS,
  which omits empty substrings.  However, the comments next to
  splitPS/splitWithPS state that the following should hold:
  
    joinPS (packString [x]) (splitPS x ls) = ls
  
  which implies that splitPS should *not* omit empty substrings.  So the
  definition of splitPS is inconsistent.  I therefore opted to fix
  splitPS to make the above property hold, and modify wordsPS to work
  with the new definition (it previously relied on the old behaviour).
  
  Revision  Changes    Path
  1.11      +15 -16    fptools/libraries/base/Data/PackedString.hs