File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
Data/Text/Internal/Fusion Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -735,8 +735,10 @@ unfoldrNI n f s0 | n < 0 = empty
735
735
-- length of the stream.
736
736
take :: Integral a => a -> Stream Char -> Stream Char
737
737
take n0 (Stream next0 s0 len) =
738
- Stream next (n0 :*: s0) (smaller len (codePointsSize $ fromIntegral n0))
738
+ Stream next (n0' :*: s0) (smaller len (codePointsSize $ fromIntegral n0' ))
739
739
where
740
+ n0' = max n0 0
741
+
740
742
{-# INLINE next #-}
741
743
next (n :*: s) | n <= 0 = Done
742
744
| otherwise = case next0 s of
@@ -753,8 +755,10 @@ data Drop a s = NS !s
753
755
-- is greater than the length of the stream.
754
756
drop :: Integral a => a -> Stream Char -> Stream Char
755
757
drop n0 (Stream next0 s0 len) =
756
- Stream next (JS n0 s0) (len - codePointsSize (fromIntegral n0))
758
+ Stream next (JS n0' s0) (len - codePointsSize (fromIntegral n0' ))
757
759
where
760
+ n0' = max n0 0
761
+
758
762
{-# INLINE next #-}
759
763
next (JS n s)
760
764
| n <= 0 = Skip (NS s)
You can’t perform that action at this time.
0 commit comments