Commits

Bryan O'Sullivan committed 1bd8ae5

Preserve invariant in lazy I/O hGetLine

  • Participants
  • Parent commits 40cde98

Comments (0)

Files changed (1)

File Data/Text/IO/Internal.hs

               let pre | isEmptyBuffer buf1 = T.empty
                       | otherwise          = T.singleton '\r'
               writeIORef haCharBuffer buf1{ bufL=0, bufR=0 }
-              let str = reverse $ pre:t:ts
-              if all T.null str
+              let str = reverse . filter (not . T.null) $ pre:t:ts
+              if null str
                 then ioe_EOF
                 else return str
          Just new_buf -> hGetLineLoop hh (t:ts) new_buf