@@ -103,14 +103,12 @@ import GHC.Exts (Addr#)
103import GHC.IO.Encoding.Failure (isSurrogate)
103import GHC.IO.Encoding.Failure (isSurrogate)
104import GHC.Ptr (Ptr (..), plusPtr)
104import GHC.Ptr (Ptr (..), plusPtr)
105import System.IO.Unsafe (unsafePerformIO)
105import System.IO.Unsafe (unsafePerformIO)
106−import Streamly.Internal.Data.Array.Unboxed (Array)
106+import Streamly.Internal.Data.Array.Unboxed.Type (Array(..))
107import Streamly.Internal.Data.Array.Unboxed.Mut.Type (MutableByteArray)
107import Streamly.Internal.Data.Array.Unboxed.Mut.Type (MutableByteArray)
108import Streamly.Internal.Data.Fold (Fold)
108import Streamly.Internal.Data.Fold (Fold)
109−import Streamly.Internal.Data.Stream.IsStream.Type
109+import Streamly.Internal.Data.Stream (Stream, fromStreamD, toStreamD)
110− (IsStream, fromStreamD, toStreamD, adapt)
111−import Streamly.Internal.Data.Stream (Stream)
112import Streamly.Internal.Data.Stream.StreamD (Step (..))
110import Streamly.Internal.Data.Stream.StreamD (Step (..))
113−import Streamly.Internal.Data.SVar (adaptState)
111+import Streamly.Internal.Data.SVar.Type (adaptState)
114import Streamly.Internal.Data.Tuple.Strict (Tuple'(..))
112import Streamly.Internal.Data.Tuple.Strict (Tuple'(..))
115import Streamly.Internal.Data.Unboxed (peekWith)
113import Streamly.Internal.Data.Unboxed (peekWith)
116import Streamly.Internal.Data.Unfold.Type (Unfold(..))
114import Streamly.Internal.Data.Unfold.Type (Unfold(..))
@@ -118,14 +116,10 @@ import Streamly.Internal.System.IO (unsafeInlineIO)
119import qualified Streamly.Data.Fold as Fold
117import qualified Streamly.Data.Fold as Fold
120import qualified Streamly.Data.Unfold as Unfold
118import qualified Streamly.Data.Unfold as Unfold
119+import qualified Streamly.Internal.Data.Array.Unboxed.Type as Array
121import qualified Streamly.Internal.Data.Parser as Parser (Parser)
120import qualified Streamly.Internal.Data.Parser as Parser (Parser)
122import qualified Streamly.Internal.Data.Parser.ParserD as ParserD
121import qualified Streamly.Internal.Data.Parser.ParserD as ParserD
123− (Parser(..), Step(..), Initial(..), toParserK, toFold)
124−import qualified Streamly.Internal.Data.Stream as Stream (fromByteStr#)
122+import qualified Streamly.Internal.Data.Stream as Stream
125−import qualified Streamly.Internal.Data.Stream.Serial as Serial
126−import qualified Streamly.Data.Array.Unboxed as Array
127−import qualified Streamly.Internal.Data.Array.Unboxed.Type as A (Array (..))
128−import qualified Streamly.Internal.Data.Stream.IsStream as S
129import qualified Streamly.Internal.Data.Stream.StreamD as D
123import qualified Streamly.Internal.Data.Stream.StreamD as D
131import Prelude hiding (lines, words, unlines, unwords)
125import Prelude hiding (lines, words, unlines, unwords)
@@ -150,8 +144,8 @@ import Prelude hiding (lines, words, unlines, unwords)
151-- @since 0.8.0
145-- @since 0.8.0
152{-# INLINE decodeLatin1 #-}
146{-# INLINE decodeLatin1 #-}
153−decodeLatin1 :: (IsStream t, Monad m) => t m Word8 -> t m Char
147+decodeLatin1 :: (Monad m) => Stream m Word8 -> Stream m Char
154−decodeLatin1 = S.map (unsafeChr . fromIntegral)
148+decodeLatin1 = fmap (unsafeChr . fromIntegral)
156-------------------------------------------------------------------------------
150-------------------------------------------------------------------------------
157-- Latin1 encoding
151-- Latin1 encoding
@@ -163,8 +157,8 @@ decodeLatin1 = S.map (unsafeChr . fromIntegral)
164-- @since 0.8.0
158-- @since 0.8.0
165{-# INLINE encodeLatin1' #-}
159{-# INLINE encodeLatin1' #-}
166−encodeLatin1' :: (IsStream t, Monad m) => t m Char -> t m Word8
160+encodeLatin1' :: (Monad m) => Stream m Char -> Stream m Word8
167−encodeLatin1' = S.map convert
161+encodeLatin1' = fmap convert
169 convert c =
163 convert c =
170 let codepoint = ord c
164 let codepoint = ord c
@@ -185,21 +179,21 @@ encodeLatin1' = S.map convert
186-- /Since: 0.8.0 (Lenient Behaviour)/
180-- /Since: 0.8.0 (Lenient Behaviour)/
187{-# INLINE encodeLatin1 #-}
181{-# INLINE encodeLatin1 #-}
188−encodeLatin1 :: (IsStream t, Monad m) => t m Char -> t m Word8
182+encodeLatin1 :: (Monad m) => Stream m Char -> Stream m Word8
189−encodeLatin1 = S.map (fromIntegral . ord)
183+encodeLatin1 = fmap (fromIntegral . ord)
191-- | Like 'encodeLatin1' but drops the input characters beyond 255.
185-- | Like 'encodeLatin1' but drops the input characters beyond 255.
193-- @since 0.8.0
187-- @since 0.8.0
194{-# INLINE encodeLatin1_ #-}
188{-# INLINE encodeLatin1_ #-}
195−encodeLatin1_ :: (IsStream t, Monad m) => t m Char -> t m Word8
189+encodeLatin1_ :: (Monad m) => Stream m Char -> Stream m Word8
196−encodeLatin1_ = S.map (fromIntegral . ord) . S.filter (<= chr 255)
190+encodeLatin1_ = fmap (fromIntegral . ord) . Stream.filter (<= chr 255)
198-- | Same as 'encodeLatin1'
192-- | Same as 'encodeLatin1'
200{-# DEPRECATED encodeLatin1Lax "Please use 'encodeLatin1' instead" #-}
194{-# DEPRECATED encodeLatin1Lax "Please use 'encodeLatin1' instead" #-}
201{-# INLINE encodeLatin1Lax #-}
195{-# INLINE encodeLatin1Lax #-}
202−encodeLatin1Lax :: (IsStream t, Monad m) => t m Char -> t m Word8
196+encodeLatin1Lax :: (Monad m) => Stream m Char -> Stream m Word8
203encodeLatin1Lax = encodeLatin1
197encodeLatin1Lax = encodeLatin1
205-------------------------------------------------------------------------------
199-------------------------------------------------------------------------------
@@ -430,8 +424,8 @@ decodeUtf8EitherD = resumeDecodeUtf8EitherD 0 0
431-- /Pre-release/
425-- /Pre-release/
432{-# INLINE decodeUtf8Either #-}
426{-# INLINE decodeUtf8Either #-}
433−decodeUtf8Either :: (Monad m, IsStream t)
427+decodeUtf8Either :: (Monad m)
434− => t m Word8 -> t m (Either DecodeError Char)
428+ => Stream m Word8 -> Stream m (Either DecodeError Char)
435decodeUtf8Either = fromStreamD . decodeUtf8EitherD . toStreamD
429decodeUtf8Either = fromStreamD . decodeUtf8EitherD . toStreamD
@@ -439,11 +433,11 @@ decodeUtf8Either = fromStreamD . decodeUtf8EitherD . toStreamD
439-- /Pre-release/
433-- /Pre-release/
440{-# INLINE resumeDecodeUtf8Either #-}
434{-# INLINE resumeDecodeUtf8Either #-}
441resumeDecodeUtf8Either
435resumeDecodeUtf8Either
442− :: (Monad m, IsStream t)
436+ :: (Monad m)
443 => DecodeState
437 => DecodeState
444 -> CodePoint
438 -> CodePoint
445− -> t m Word8
439+ -> Stream m Word8
446− -> t m (Either DecodeError Char)
440+ -> Stream m (Either DecodeError Char)
447resumeDecodeUtf8Either st cp =
441resumeDecodeUtf8Either st cp =
448 fromStreamD . resumeDecodeUtf8EitherD st cp . toStreamD
442 fromStreamD . resumeDecodeUtf8EitherD st cp . toStreamD
@@ -663,7 +657,7 @@ decodeUtf8D = decodeUtf8WithD TransliterateCodingFailure
664-- /Since: 0.8.0 (Lenient Behaviour)/
658-- /Since: 0.8.0 (Lenient Behaviour)/
665{-# INLINE decodeUtf8 #-}
659{-# INLINE decodeUtf8 #-}
666−decodeUtf8 :: (Monad m, IsStream t) => t m Word8 -> t m Char
660+decodeUtf8 :: (Monad m) => Stream m Word8 -> Stream m Char
667decodeUtf8 = fromStreamD . decodeUtf8D . toStreamD
661decodeUtf8 = fromStreamD . decodeUtf8D . toStreamD
669{-# INLINE decodeUtf8D' #-}
663{-# INLINE decodeUtf8D' #-}
@@ -675,7 +669,7 @@ decodeUtf8D' = decodeUtf8WithD ErrorOnCodingFailure
676-- @since 0.8.0
670-- @since 0.8.0
677{-# INLINE decodeUtf8' #-}
671{-# INLINE decodeUtf8' #-}
678−decodeUtf8' :: (Monad m, IsStream t) => t m Word8 -> t m Char
672+decodeUtf8' :: (Monad m) => Stream m Word8 -> Stream m Char
679decodeUtf8' = fromStreamD . decodeUtf8D' . toStreamD
673decodeUtf8' = fromStreamD . decodeUtf8D' . toStreamD
681{-# INLINE decodeUtf8D_ #-}
675{-# INLINE decodeUtf8D_ #-}
@@ -687,14 +681,14 @@ decodeUtf8D_ = decodeUtf8WithD DropOnCodingFailure
688-- @since 0.8.0
682-- @since 0.8.0
689{-# INLINE decodeUtf8_ #-}
683{-# INLINE decodeUtf8_ #-}
690−decodeUtf8_ :: (Monad m, IsStream t) => t m Word8 -> t m Char
684+decodeUtf8_ :: (Monad m) => Stream m Word8 -> Stream m Char
691decodeUtf8_ = fromStreamD . decodeUtf8D_ . toStreamD
685decodeUtf8_ = fromStreamD . decodeUtf8D_ . toStreamD
693-- | Same as 'decodeUtf8'
687-- | Same as 'decodeUtf8'
695{-# DEPRECATED decodeUtf8Lax "Please use 'decodeUtf8' instead" #-}
689{-# DEPRECATED decodeUtf8Lax "Please use 'decodeUtf8' instead" #-}
696{-# INLINE decodeUtf8Lax #-}
690{-# INLINE decodeUtf8Lax #-}
697−decodeUtf8Lax :: (IsStream t, Monad m) => t m Word8 -> t m Char
691+decodeUtf8Lax :: (Monad m) => Stream m Word8 -> Stream m Char
698decodeUtf8Lax = decodeUtf8
692decodeUtf8Lax = decodeUtf8
700-------------------------------------------------------------------------------
694-------------------------------------------------------------------------------
@@ -726,7 +720,7 @@ data FlattenState s a
726decodeUtf8ArraysWithD ::
720decodeUtf8ArraysWithD ::
727 MonadIO m
721 MonadIO m
728 => CodingFailureMode
722 => CodingFailureMode
729− -> D.Stream m (A.Array Word8)
723+ -> D.Stream m (Array Word8)
730 -> D.Stream m Char
724 -> D.Stream m Char
731decodeUtf8ArraysWithD cfm (D.Stream step state) =
725decodeUtf8ArraysWithD cfm (D.Stream step state) =
732 D.Stream (step' utf8d) (OuterLoop state Nothing)
726 D.Stream (step' utf8d) (OuterLoop state Nothing)
@@ -751,7 +745,7 @@ decodeUtf8ArraysWithD cfm (D.Stream step state) =
751 r <- step (adaptState gst) st
745 r <- step (adaptState gst) st
753 case r of
747 case r of
754− Yield A.Array {..} s ->
748+ Yield Array {..} s ->
755 Skip (InnerLoopDecodeInit s arrContents arrStart arrEnd)
749 Skip (InnerLoopDecodeInit s arrContents arrStart arrEnd)
756 Skip s -> Skip (OuterLoop s Nothing)
750 Skip s -> Skip (OuterLoop s Nothing)
757 Stop -> Skip D
751 Stop -> Skip D
@@ -759,7 +753,7 @@ decodeUtf8ArraysWithD cfm (D.Stream step state) =
759 r <- step (adaptState gst) st
753 r <- step (adaptState gst) st
761 case r of
755 case r of
762− Yield A.Array {..} s ->
756+ Yield Array {..} s ->
763 Skip (InnerLoopDecoding s arrContents arrStart arrEnd ds cp)
757 Skip (InnerLoopDecoding s arrContents arrStart arrEnd ds cp)
764 Skip s -> Skip (OuterLoop s dst)
758 Skip s -> Skip (OuterLoop s dst)
765 Stop -> Skip inputUnderflow
759 Stop -> Skip inputUnderflow
@@ -828,7 +822,7 @@ decodeUtf8ArraysWithD cfm (D.Stream step state) =
828{-# INLINE decodeUtf8ArraysD #-}
822{-# INLINE decodeUtf8ArraysD #-}
829decodeUtf8ArraysD ::
823decodeUtf8ArraysD ::
830 MonadIO m
824 MonadIO m
831− => D.Stream m (A.Array Word8)
825+ => D.Stream m (Array Word8)
832 -> D.Stream m Char
826 -> D.Stream m Char
833decodeUtf8ArraysD = decodeUtf8ArraysWithD TransliterateCodingFailure
827decodeUtf8ArraysD = decodeUtf8ArraysWithD TransliterateCodingFailure
@@ -837,14 +831,14 @@ decodeUtf8ArraysD = decodeUtf8ArraysWithD TransliterateCodingFailure
837-- /Pre-release/
831-- /Pre-release/
838{-# INLINE decodeUtf8Arrays #-}
832{-# INLINE decodeUtf8Arrays #-}
839decodeUtf8Arrays ::
833decodeUtf8Arrays ::
840− (MonadIO m, IsStream t) => t m (Array Word8) -> t m Char
834+ (MonadIO m) => Stream m (Array Word8) -> Stream m Char
841decodeUtf8Arrays =
835decodeUtf8Arrays =
842 fromStreamD . decodeUtf8ArraysD . toStreamD
836 fromStreamD . decodeUtf8ArraysD . toStreamD
844{-# INLINE decodeUtf8ArraysD' #-}
838{-# INLINE decodeUtf8ArraysD' #-}
845decodeUtf8ArraysD' ::
839decodeUtf8ArraysD' ::
846 MonadIO m
840 MonadIO m
847− => D.Stream m (A.Array Word8)
841+ => D.Stream m (Array Word8)
848 -> D.Stream m Char
842 -> D.Stream m Char
849decodeUtf8ArraysD' = decodeUtf8ArraysWithD ErrorOnCodingFailure
843decodeUtf8ArraysD' = decodeUtf8ArraysWithD ErrorOnCodingFailure
@@ -852,13 +846,13 @@ decodeUtf8ArraysD' = decodeUtf8ArraysWithD ErrorOnCodingFailure
853-- /Pre-release/
847-- /Pre-release/
854{-# INLINE decodeUtf8Arrays' #-}
848{-# INLINE decodeUtf8Arrays' #-}
855−decodeUtf8Arrays' :: (MonadIO m, IsStream t) => t m (Array Word8) -> t m Char
849+decodeUtf8Arrays' :: (MonadIO m) => Stream m (Array Word8) -> Stream m Char
856decodeUtf8Arrays' = fromStreamD . decodeUtf8ArraysD' . toStreamD
850decodeUtf8Arrays' = fromStreamD . decodeUtf8ArraysD' . toStreamD
858{-# INLINE decodeUtf8ArraysD_ #-}
852{-# INLINE decodeUtf8ArraysD_ #-}
859decodeUtf8ArraysD_ ::
853decodeUtf8ArraysD_ ::
860 MonadIO m
854 MonadIO m
861− => D.Stream m (A.Array Word8)
855+ => D.Stream m (Array Word8)
862 -> D.Stream m Char
856 -> D.Stream m Char
863decodeUtf8ArraysD_ = decodeUtf8ArraysWithD DropOnCodingFailure
857decodeUtf8ArraysD_ = decodeUtf8ArraysWithD DropOnCodingFailure
@@ -867,7 +861,7 @@ decodeUtf8ArraysD_ = decodeUtf8ArraysWithD DropOnCodingFailure
867-- /Pre-release/
861-- /Pre-release/
868{-# INLINE decodeUtf8Arrays_ #-}
862{-# INLINE decodeUtf8Arrays_ #-}
869decodeUtf8Arrays_ ::
863decodeUtf8Arrays_ ::
870− (MonadIO m, IsStream t) => t m (Array Word8) -> t m Char
864+ (MonadIO m) => Stream m (Array Word8) -> Stream m Char
871decodeUtf8Arrays_ =
865decodeUtf8Arrays_ =
872 fromStreamD . decodeUtf8ArraysD_ . toStreamD
866 fromStreamD . decodeUtf8ArraysD_ . toStreamD
@@ -943,7 +937,7 @@ encodeUtf8D' = D.unfoldMany readCharUtf8'
944-- @since 0.8.0
938-- @since 0.8.0
945{-# INLINE encodeUtf8' #-}
939{-# INLINE encodeUtf8' #-}
946−encodeUtf8' :: (Monad m, IsStream t) => t m Char -> t m Word8
940+encodeUtf8' :: (Monad m) => Stream m Char -> Stream m Word8
947encodeUtf8' = fromStreamD . encodeUtf8D' . toStreamD
941encodeUtf8' = fromStreamD . encodeUtf8D' . toStreamD
949{-# INLINE_NORMAL readCharUtf8 #-}
943{-# INLINE_NORMAL readCharUtf8 #-}
@@ -965,7 +959,7 @@ encodeUtf8D = D.unfoldMany readCharUtf8
966-- /Since: 0.8.0 (Lenient Behaviour)/
960-- /Since: 0.8.0 (Lenient Behaviour)/
967{-# INLINE encodeUtf8 #-}
961{-# INLINE encodeUtf8 #-}
968−encodeUtf8 :: (Monad m, IsStream t) => t m Char -> t m Word8
962+encodeUtf8 :: (Monad m) => Stream m Char -> Stream m Word8
969encodeUtf8 = fromStreamD . encodeUtf8D . toStreamD
963encodeUtf8 = fromStreamD . encodeUtf8D . toStreamD
971{-# INLINE_NORMAL readCharUtf8_ #-}
965{-# INLINE_NORMAL readCharUtf8_ #-}
@@ -981,14 +975,14 @@ encodeUtf8D_ = D.unfoldMany readCharUtf8_
982-- @since 0.8.0
976-- @since 0.8.0
983{-# INLINE encodeUtf8_ #-}
977{-# INLINE encodeUtf8_ #-}
984−encodeUtf8_ :: (Monad m, IsStream t) => t m Char -> t m Word8
978+encodeUtf8_ :: (Monad m) => Stream m Char -> Stream m Word8
985encodeUtf8_ = fromStreamD . encodeUtf8D_ . toStreamD
979encodeUtf8_ = fromStreamD . encodeUtf8D_ . toStreamD
987-- | Same as 'encodeUtf8'
981-- | Same as 'encodeUtf8'
989{-# DEPRECATED encodeUtf8Lax "Please use 'encodeUtf8' instead" #-}
983{-# DEPRECATED encodeUtf8Lax "Please use 'encodeUtf8' instead" #-}
990{-# INLINE encodeUtf8Lax #-}
984{-# INLINE encodeUtf8Lax #-}
991−encodeUtf8Lax :: (IsStream t, Monad m) => t m Char -> t m Word8
985+encodeUtf8Lax :: (Monad m) => Stream m Char -> Stream m Word8
992encodeUtf8Lax = encodeUtf8
986encodeUtf8Lax = encodeUtf8
994-------------------------------------------------------------------------------
988-------------------------------------------------------------------------------
@@ -1024,27 +1018,27 @@ encodeObject :: MonadIO m =>
1024 -> Unfold m a Char
1018 -> Unfold m a Char
1026 -> m (Array Word8)
1020 -> m (Array Word8)
1027−encodeObject encode u = S.fold Array.write . encode . S.unfold u
1021+encodeObject encode u = Stream.fold Array.write . encode . Stream.unfold u
1029-- | Encode a stream of container objects using the supplied encoding scheme.
1023-- | Encode a stream of container objects using the supplied encoding scheme.
1030-- Each object is encoded as an @Array Word8@.
1024-- Each object is encoded as an @Array Word8@.
1032-- /Internal/
1026-- /Internal/
1033{-# INLINE encodeObjects #-}
1027{-# INLINE encodeObjects #-}
1034−encodeObjects :: (MonadIO m, IsStream t) =>
1028+encodeObjects :: (MonadIO m) =>
1035 (Stream m Char -> Stream m Word8)
1029 (Stream m Char -> Stream m Word8)
1036 -> Unfold m a Char
1030 -> Unfold m a Char
1037− -> t m a
1031+ -> Stream m a
1038− -> t m (Array Word8)
1032+ -> Stream m (Array Word8)
1039−encodeObjects encode u = adapt . Serial.mapM (encodeObject encode u) . adapt
1033+encodeObjects encode u = Stream.mapM (encodeObject encode u)
1041-- | Encode a stream of 'String' using the supplied encoding scheme. Each
1035-- | Encode a stream of 'String' using the supplied encoding scheme. Each
1042-- string is encoded as an @Array Word8@.
1036-- string is encoded as an @Array Word8@.
1044-- @since 0.8.0
1038-- @since 0.8.0
1045{-# INLINE encodeStrings #-}
1039{-# INLINE encodeStrings #-}
1046−encodeStrings :: (MonadIO m, IsStream t) =>
1040+encodeStrings :: (MonadIO m) =>
1047− (Stream m Char -> Stream m Word8) -> t m String -> t m (Array Word8)
1041+ (Stream m Char -> Stream m Word8) -> Stream m String -> Stream m (Array Word8)
1048encodeStrings encode = encodeObjects encode Unfold.fromList
1042encodeStrings encode = encodeObjects encode Unfold.fromList
@@ -1052,21 +1046,21 @@ encodeStrings encode = encodeObjects encode Unfold.fromList
1052-- Utility operations on strings
1046-- Utility operations on strings
1053-------------------------------------------------------------------------------
1047-------------------------------------------------------------------------------
1055−strip :: IsStream t => t m Char -> t m Char
1049+strip :: IsStream t => Stream m Char -> Stream m Char
1056strip = undefined
1050strip = undefined
1058−stripTail :: IsStream t => t m Char -> t m Char
1052+stripTail :: IsStream t => Stream m Char -> Stream m Char
1059stripTail = undefined
1053stripTail = undefined
1062-- | Remove leading whitespace from a string.
1056-- | Remove leading whitespace from a string.
1064−-- > stripHead = S.dropWhile isSpace
1058+-- > stripHead = Stream.dropWhile isSpace
1066-- /Pre-release/
1060-- /Pre-release/
1067{-# INLINE stripHead #-}
1061{-# INLINE stripHead #-}
1068−stripHead :: (Monad m, IsStream t) => t m Char -> t m Char
1062+stripHead :: (Monad m) => Stream m Char -> Stream m Char
1069−stripHead = S.dropWhile isSpace
1063+stripHead = Stream.dropWhile isSpace
1071-- | Fold each line of the stream using the supplied 'Fold'
1065-- | Fold each line of the stream using the supplied 'Fold'
1072-- and stream the result.
1066-- and stream the result.
@@ -1074,12 +1068,12 @@ stripHead = S.dropWhile isSpace
1074-- >>> Stream.toList $ lines Fold.toList (Stream.fromList "lines\nthis\nstring\n\n\n")
1068-- >>> Stream.toList $ lines Fold.toList (Stream.fromList "lines\nthis\nstring\n\n\n")
1075-- ["lines","this","string","",""]
1069-- ["lines","this","string","",""]
1077−-- > lines = S.splitOnSuffix (== '\n')
1071+-- > lines = Stream.splitOnSuffix (== '\n')
1079-- /Pre-release/
1073-- /Pre-release/
1080{-# INLINE lines #-}
1074{-# INLINE lines #-}
1081−lines :: (Monad m, IsStream t) => Fold m Char b -> t m Char -> t m b
1075+lines :: (Monad m) => Fold m Char b -> Stream m Char -> Stream m b
1082−lines = S.splitOnSuffix (== '\n')
1076+lines f = Stream.foldMany (Fold.takeEndBy_ (== '\n') f)
1084#if !MIN_VERSION_base(4,17,0)
1078#if !MIN_VERSION_base(4,17,0)
1085foreign import ccall unsafe "u_iswspace"
1079foreign import ccall unsafe "u_iswspace"
@@ -1105,12 +1099,12 @@ isSpace c
1105-- >>> Stream.toList $ words Fold.toList (Stream.fromList "fold these words")
1099-- >>> Stream.toList $ words Fold.toList (Stream.fromList "fold these words")
1106-- ["fold","these","words"]
1100-- ["fold","these","words"]
1108−-- > words = S.wordsBy isSpace
1102+-- > words = Stream.wordsBy isSpace
1110-- /Pre-release/
1104-- /Pre-release/
1111{-# INLINE words #-}
1105{-# INLINE words #-}
1112−words :: (Monad m, IsStream t) => Fold m Char b -> t m Char -> t m b
1106+words :: (Monad m) => Fold m Char b -> Stream m Char -> Stream m b
1113−words = S.wordsBy isSpace
1107+words f m = Stream.fromStreamD $ D.wordsBy isSpace f (Stream.toStreamD m)
1115-- | Unfold a stream to character streams using the supplied 'Unfold'
1109-- | Unfold a stream to character streams using the supplied 'Unfold'
1116-- and concat the results suffixing a newline character @\\n@ to each stream.
1110-- and concat the results suffixing a newline character @\\n@ to each stream.
@@ -1122,8 +1116,8 @@ words = S.wordsBy isSpace
1123-- /Pre-release/
1117-- /Pre-release/
1124{-# INLINE unlines #-}
1118{-# INLINE unlines #-}
1125−unlines :: (MonadIO m, IsStream t) => Unfold m a Char -> t m a -> t m Char
1119+unlines :: (MonadIO m) => Unfold m a Char -> Stream m a -> Stream m Char
1126−unlines = S.interposeSuffix '\n'
1120+unlines = Stream.interposeSuffix '\n'
1128-- | Unfold the elements of a stream to character streams using the supplied
1122-- | Unfold the elements of a stream to character streams using the supplied
1129-- 'Unfold' and concat the results with a whitespace character infixed between
1123-- 'Unfold' and concat the results with a whitespace character infixed between
@@ -1136,5 +1130,5 @@ unlines = S.interposeSuffix '\n'
1137-- /Pre-release/
1131-- /Pre-release/
1138{-# INLINE unwords #-}
1132{-# INLINE unwords #-}
1139−unwords :: (MonadIO m, IsStream t) => Unfold m a Char -> t m a -> t m Char
1133+unwords :: (MonadIO m) => Unfold m a Char -> Stream m a -> Stream m Char
1140−unwords = S.interpose ' '
1134+unwords = Stream.interpose ' '