]> git.immae.eu Git - github/fretlink/text-pipes.git/commitdiff
Gabriel's emended 'lines'
authormichaelt <what_is_it_to_do_anything@yahoo.com>
Mon, 18 Nov 2013 15:32:44 +0000 (10:32 -0500)
committermichaelt <what_is_it_to_do_anything@yahoo.com>
Mon, 18 Nov 2013 15:32:44 +0000 (10:32 -0500)
Pipes/Text.hs

index cc082560879c4d46a6d969093de439dba1a6872b..f2b4aacf5e09892d010ab1273e39b1b2ea3f9bb8 100644 (file)
@@ -781,12 +781,11 @@ lines p0 = PP.FreeT (go0 p0)
                 else return $ PP.Free $ go1 (yield txt >> p')
     go1 p = do
         p' <- break ('\n' ==) p
-        return $ PP.FreeT (go2 p')
-    go2 p = do
-        x  <- nextChar p
-        return $ case x of
-            Left   r      -> PP.Pure r
-            Right (_, p') -> PP.Free (go1 p')
+        return $ PP.FreeT $ do
+            x  <- nextChar p'
+            case x of
+                Left   r      -> return $ PP.Pure r
+                Right (_, p'') -> go0 p''
 {-# INLINABLE lines #-}