Commit 2d16756 DDC
committed
1 parent 39d0767 commit 2d16756 Copy full SHA for 2d16756
File tree 2 files changed +15
-0
lines changed
2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ import qualified Test.PipesStreaming.Streamy.Bytes as YB
11
11
12
12
import Data.Foldable hiding (concat )
13
13
import qualified Data.ByteString as B
14
+ import qualified Data.Text as T
14
15
import Data.Monoid
15
16
import Data.List.NonEmpty (NonEmpty (.. ))
16
17
import Control.Applicative
@@ -138,3 +139,16 @@ testDelimitChunksOf = do
138
139
(\ _ -> [] :| [] )
139
140
0
140
141
142
+ textlines :: Stream T. Text IO r -> Groups T. Text IO r
143
+ textlines =
144
+ Y. delimit (\ nl txt ->
145
+ if T. null txt
146
+ then (nl,pure [] )
147
+ else let nl' = T. last txt == ' \n '
148
+ in case (nl,T. lines txt) of
149
+ (True ,ls) -> (nl', [] :| map pure ls)
150
+ (False ,l: ls) -> (nl', [l] :| map pure ls)
151
+ (_,[] ) -> error " never happens" )
152
+ (\ _ -> pure [] )
153
+ True
154
+
Original file line number Diff line number Diff line change @@ -37,6 +37,7 @@ library test-pipes-streaming
37
37
base >= 4.10 && < 4.11 ,
38
38
transformers > 0.5 ,
39
39
bytestring ,
40
+ text >= 1.2 ,
40
41
tasty >= 0.10.1.1 ,
41
42
tasty-hunit >= 0.9.2 ,
42
43
streamy-bytes-sig == 0.1.0.0
You can’t perform that action at this time.
0 commit comments