@@ -100,14 +100,16 @@ tl_utf32BE = forAll genUnicode $ (EL.decodeUtf32BE . EL.encodeUtf32BE) `eq` id
100100t_utf8_incr = do
101101 Positive n <- arbitrary
102102 forAll genUnicode $ recode n `eq` id
103− where recode n = T.concat . feedChunksOf n E.streamDecodeUtf8 . E.encodeUtf8
104− feedChunksOf :: Int -> (B.ByteString -> E.Decoding) -> B.ByteString
105− -> [T.Text]
106− feedChunksOf n f bs
107− | B.null bs = []
108− | otherwise = let (a,b) = B.splitAt n bs
109− E.Some t _ f' = f a
110− in t : feedChunksOf n f' b
103+ where recode n = T.concat . map fst . feedChunksOf n E.streamDecodeUtf8 .
104+ E.encodeUtf8
105+
106+feedChunksOf :: Int -> (B.ByteString -> E.Decoding) -> B.ByteString
107+ -> [(T.Text, B.ByteString)]
108+feedChunksOf n f bs
109+ | B.null bs = []
110+ | otherwise = let (x,y) = B.splitAt n bs
111+ E.Some t b f' = f x
112+ in (t,b) : feedChunksOf n f' y
111113
112114data Badness = Solo | Leading | Trailing
113115 deriving (Eq, Show)