on master help sign in
Move Console.Stdio to streamly-core
88334a8Ranjeet Kumar Ranjan
src/Streamly/Console/Stdio.hs → core/src/Streamly/Console/Stdio.hsrenamed

The content is the same.

src/Streamly/Internal/Console/Stdio.hs → core/src/Streamly/Internal/Console/Stdio.hsrenamed+3−3
@@ -47,9 +47,9 @@ import Streamly.Internal.Data.Stream (Stream)
47import Streamly.Internal.Data.Unfold (Unfold)
47import Streamly.Internal.Data.Unfold (Unfold)
48import Streamly.Internal.Data.Fold (Fold)
48import Streamly.Internal.Data.Fold (Fold)
49
49
50−import qualified Streamly.Data.Array.Unboxed as Array (fromList)
50+import qualified Streamly.Internal.Data.Array.Unboxed as Array
51−import qualified Streamly.Data.Unfold as Unfold (lmap)
51+import qualified Streamly.Internal.Data.Stream as Stream (intersperseSuffix)
52−import qualified Streamly.Internal.Data.Stream.IsStream as Stream
52+import qualified Streamly.Internal.Data.Unfold as Unfold
53import qualified Streamly.Internal.FileSystem.Handle as Handle
53import qualified Streamly.Internal.FileSystem.Handle as Handle
54import qualified Streamly.Internal.Unicode.Stream as Unicode
54import qualified Streamly.Internal.Unicode.Stream as Unicode
55
55
core/src/Streamly/Internal/Unicode/Stream.hs+18−18
@@ -144,7 +144,7 @@ import Prelude hiding (lines, words, unlines, unwords)
144--
144--
145-- @since 0.8.0
145-- @since 0.8.0
146{-# INLINE decodeLatin1 #-}
146{-# INLINE decodeLatin1 #-}
147−decodeLatin1 :: (Monad m) => Stream m Word8 -> Stream m Char
147+decodeLatin1 :: Monad m => Stream m Word8 -> Stream m Char
148decodeLatin1 = fmap (unsafeChr . fromIntegral)
148decodeLatin1 = fmap (unsafeChr . fromIntegral)
149
149
150-------------------------------------------------------------------------------
150-------------------------------------------------------------------------------
@@ -157,7 +157,7 @@ decodeLatin1 = fmap (unsafeChr . fromIntegral)
157--
157--
158-- @since 0.8.0
158-- @since 0.8.0
159{-# INLINE encodeLatin1' #-}
159{-# INLINE encodeLatin1' #-}
160−encodeLatin1' :: (Monad m) => Stream m Char -> Stream m Word8
160+encodeLatin1' :: Monad m => Stream m Char -> Stream m Word8
161encodeLatin1' = fmap convert
161encodeLatin1' = fmap convert
162 where
162 where
163 convert c =
163 convert c =
@@ -179,21 +179,21 @@ encodeLatin1' = fmap convert
179--
179--
180-- /Since: 0.8.0 (Lenient Behaviour)/
180-- /Since: 0.8.0 (Lenient Behaviour)/
181{-# INLINE encodeLatin1 #-}
181{-# INLINE encodeLatin1 #-}
182−encodeLatin1 :: (Monad m) => Stream m Char -> Stream m Word8
182+encodeLatin1 :: Monad m => Stream m Char -> Stream m Word8
183encodeLatin1 = fmap (fromIntegral . ord)
183encodeLatin1 = fmap (fromIntegral . ord)
184
184
185-- | Like 'encodeLatin1' but drops the input characters beyond 255.
185-- | Like 'encodeLatin1' but drops the input characters beyond 255.
186--
186--
187-- @since 0.8.0
187-- @since 0.8.0
188{-# INLINE encodeLatin1_ #-}
188{-# INLINE encodeLatin1_ #-}
189−encodeLatin1_ :: (Monad m) => Stream m Char -> Stream m Word8
189+encodeLatin1_ :: Monad m => Stream m Char -> Stream m Word8
190encodeLatin1_ = fmap (fromIntegral . ord) . Stream.filter (<= chr 255)
190encodeLatin1_ = fmap (fromIntegral . ord) . Stream.filter (<= chr 255)
191
191
192-- | Same as 'encodeLatin1'
192-- | Same as 'encodeLatin1'
193--
193--
194{-# DEPRECATED encodeLatin1Lax "Please use 'encodeLatin1' instead" #-}
194{-# DEPRECATED encodeLatin1Lax "Please use 'encodeLatin1' instead" #-}
195{-# INLINE encodeLatin1Lax #-}
195{-# INLINE encodeLatin1Lax #-}
196−encodeLatin1Lax :: (Monad m) => Stream m Char -> Stream m Word8
196+encodeLatin1Lax :: Monad m => Stream m Char -> Stream m Word8
197encodeLatin1Lax = encodeLatin1
197encodeLatin1Lax = encodeLatin1
198
198
199-------------------------------------------------------------------------------
199-------------------------------------------------------------------------------
@@ -424,7 +424,7 @@ decodeUtf8EitherD = resumeDecodeUtf8EitherD 0 0
424--
424--
425-- /Pre-release/
425-- /Pre-release/
426{-# INLINE decodeUtf8Either #-}
426{-# INLINE decodeUtf8Either #-}
427−decodeUtf8Either :: (Monad m)
427+decodeUtf8Either :: Monad m
428 => Stream m Word8 -> Stream m (Either DecodeError Char)
428 => Stream m Word8 -> Stream m (Either DecodeError Char)
429decodeUtf8Either = fromStreamD . decodeUtf8EitherD . toStreamD
429decodeUtf8Either = fromStreamD . decodeUtf8EitherD . toStreamD
430
430
@@ -433,7 +433,7 @@ decodeUtf8Either = fromStreamD . decodeUtf8EitherD . toStreamD
433-- /Pre-release/
433-- /Pre-release/
434{-# INLINE resumeDecodeUtf8Either #-}
434{-# INLINE resumeDecodeUtf8Either #-}
435resumeDecodeUtf8Either
435resumeDecodeUtf8Either
436− :: (Monad m)
436+ :: Monad m
437 => DecodeState
437 => DecodeState
438 -> CodePoint
438 -> CodePoint
439 -> Stream m Word8
439 -> Stream m Word8
@@ -657,7 +657,7 @@ decodeUtf8D = decodeUtf8WithD TransliterateCodingFailure
657--
657--
658-- /Since: 0.8.0 (Lenient Behaviour)/
658-- /Since: 0.8.0 (Lenient Behaviour)/
659{-# INLINE decodeUtf8 #-}
659{-# INLINE decodeUtf8 #-}
660−decodeUtf8 :: (Monad m) => Stream m Word8 -> Stream m Char
660+decodeUtf8 :: Monad m => Stream m Word8 -> Stream m Char
661decodeUtf8 = fromStreamD . decodeUtf8D . toStreamD
661decodeUtf8 = fromStreamD . decodeUtf8D . toStreamD
662
662
663{-# INLINE decodeUtf8D' #-}
663{-# INLINE decodeUtf8D' #-}
@@ -669,7 +669,7 @@ decodeUtf8D' = decodeUtf8WithD ErrorOnCodingFailure
669--
669--
670-- @since 0.8.0
670-- @since 0.8.0
671{-# INLINE decodeUtf8' #-}
671{-# INLINE decodeUtf8' #-}
672−decodeUtf8' :: (Monad m) => Stream m Word8 -> Stream m Char
672+decodeUtf8' :: Monad m => Stream m Word8 -> Stream m Char
673decodeUtf8' = fromStreamD . decodeUtf8D' . toStreamD
673decodeUtf8' = fromStreamD . decodeUtf8D' . toStreamD
674
674
675{-# INLINE decodeUtf8D_ #-}
675{-# INLINE decodeUtf8D_ #-}
@@ -681,14 +681,14 @@ decodeUtf8D_ = decodeUtf8WithD DropOnCodingFailure
681--
681--
682-- @since 0.8.0
682-- @since 0.8.0
683{-# INLINE decodeUtf8_ #-}
683{-# INLINE decodeUtf8_ #-}
684−decodeUtf8_ :: (Monad m) => Stream m Word8 -> Stream m Char
684+decodeUtf8_ :: Monad m => Stream m Word8 -> Stream m Char
685decodeUtf8_ = fromStreamD . decodeUtf8D_ . toStreamD
685decodeUtf8_ = fromStreamD . decodeUtf8D_ . toStreamD
686
686
687-- | Same as 'decodeUtf8'
687-- | Same as 'decodeUtf8'
688--
688--
689{-# DEPRECATED decodeUtf8Lax "Please use 'decodeUtf8' instead" #-}
689{-# DEPRECATED decodeUtf8Lax "Please use 'decodeUtf8' instead" #-}
690{-# INLINE decodeUtf8Lax #-}
690{-# INLINE decodeUtf8Lax #-}
691−decodeUtf8Lax :: (Monad m) => Stream m Word8 -> Stream m Char
691+decodeUtf8Lax :: Monad m => Stream m Word8 -> Stream m Char
692decodeUtf8Lax = decodeUtf8
692decodeUtf8Lax = decodeUtf8
693
693
694-------------------------------------------------------------------------------
694-------------------------------------------------------------------------------
@@ -936,7 +936,7 @@ encodeUtf8D' = D.unfoldMany readCharUtf8'
936--
936--
937-- @since 0.8.0
937-- @since 0.8.0
938{-# INLINE encodeUtf8' #-}
938{-# INLINE encodeUtf8' #-}
939−encodeUtf8' :: (Monad m) => Stream m Char -> Stream m Word8
939+encodeUtf8' :: Monad m => Stream m Char -> Stream m Word8
940encodeUtf8' = fromStreamD . encodeUtf8D' . toStreamD
940encodeUtf8' = fromStreamD . encodeUtf8D' . toStreamD
941
941
942{-# INLINE_NORMAL readCharUtf8 #-}
942{-# INLINE_NORMAL readCharUtf8 #-}
@@ -958,7 +958,7 @@ encodeUtf8D = D.unfoldMany readCharUtf8
958--
958--
959-- /Since: 0.8.0 (Lenient Behaviour)/
959-- /Since: 0.8.0 (Lenient Behaviour)/
960{-# INLINE encodeUtf8 #-}
960{-# INLINE encodeUtf8 #-}
961−encodeUtf8 :: (Monad m) => Stream m Char -> Stream m Word8
961+encodeUtf8 :: Monad m => Stream m Char -> Stream m Word8
962encodeUtf8 = fromStreamD . encodeUtf8D . toStreamD
962encodeUtf8 = fromStreamD . encodeUtf8D . toStreamD
963
963
964{-# INLINE_NORMAL readCharUtf8_ #-}
964{-# INLINE_NORMAL readCharUtf8_ #-}
@@ -974,14 +974,14 @@ encodeUtf8D_ = D.unfoldMany readCharUtf8_
974--
974--
975-- @since 0.8.0
975-- @since 0.8.0
976{-# INLINE encodeUtf8_ #-}
976{-# INLINE encodeUtf8_ #-}
977−encodeUtf8_ :: (Monad m) => Stream m Char -> Stream m Word8
977+encodeUtf8_ :: Monad m => Stream m Char -> Stream m Word8
978encodeUtf8_ = fromStreamD . encodeUtf8D_ . toStreamD
978encodeUtf8_ = fromStreamD . encodeUtf8D_ . toStreamD
979
979
980-- | Same as 'encodeUtf8'
980-- | Same as 'encodeUtf8'
981--
981--
982{-# DEPRECATED encodeUtf8Lax "Please use 'encodeUtf8' instead" #-}
982{-# DEPRECATED encodeUtf8Lax "Please use 'encodeUtf8' instead" #-}
983{-# INLINE encodeUtf8Lax #-}
983{-# INLINE encodeUtf8Lax #-}
984−encodeUtf8Lax :: (Monad m) => Stream m Char -> Stream m Word8
984+encodeUtf8Lax :: Monad m => Stream m Char -> Stream m Word8
985encodeUtf8Lax = encodeUtf8
985encodeUtf8Lax = encodeUtf8
986
986
987-------------------------------------------------------------------------------
987-------------------------------------------------------------------------------
@@ -1060,7 +1060,7 @@ stripTail = undefined
1060--
1060--
1061-- /Pre-release/
1061-- /Pre-release/
1062{-# INLINE stripHead #-}
1062{-# INLINE stripHead #-}
1063−stripHead :: (Monad m) => Stream m Char -> Stream m Char
1063+stripHead :: Monad m => Stream m Char -> Stream m Char
1064stripHead = Stream.dropWhile isSpace
1064stripHead = Stream.dropWhile isSpace
1065
1065
1066-- | Fold each line of the stream using the supplied 'Fold'
1066-- | Fold each line of the stream using the supplied 'Fold'
@@ -1073,7 +1073,7 @@ stripHead = Stream.dropWhile isSpace
1073--
1073--
1074-- /Pre-release/
1074-- /Pre-release/
1075{-# INLINE lines #-}
1075{-# INLINE lines #-}
1076−lines :: (Monad m) => Fold m Char b -> Stream m Char -> Stream m b
1076+lines :: Monad m => Fold m Char b -> Stream m Char -> Stream m b
1077lines f = Stream.foldMany (Fold.takeEndBy_ (== '\n') f)
1077lines f = Stream.foldMany (Fold.takeEndBy_ (== '\n') f)
1078
1078
1079#if !MIN_VERSION_base(4,17,0)
1079#if !MIN_VERSION_base(4,17,0)
@@ -1104,7 +1104,7 @@ isSpace c
1104--
1104--
1105-- /Pre-release/
1105-- /Pre-release/
1106{-# INLINE words #-}
1106{-# INLINE words #-}
1107−words :: (Monad m) => Fold m Char b -> Stream m Char -> Stream m b
1107+words :: Monad m => Fold m Char b -> Stream m Char -> Stream m b
1108words f m = Stream.fromStreamD $ D.wordsBy isSpace f (Stream.toStreamD m)
1108words f m = Stream.fromStreamD $ D.wordsBy isSpace f (Stream.toStreamD m)
1109
1109
1110-- | Unfold a stream to character streams using the supplied 'Unfold'
1110-- | Unfold a stream to character streams using the supplied 'Unfold'
streamly.cabal+2−6
@@ -228,6 +228,8 @@ extra-source-files:
228 core/src/Streamly/Internal/Unicode/Stream.hs
228 core/src/Streamly/Internal/Unicode/Stream.hs
229 core/src/Streamly/Internal/Unicode/String.hs
229 core/src/Streamly/Internal/Unicode/String.hs
230 core/src/Streamly/Unicode/Stream.hs
230 core/src/Streamly/Unicode/Stream.hs
231+ core/src/Streamly/Console/Stdio.hs
232+ core/src/Streamly/Internal/Console/Stdio.hs
231 core/streamly-core.cabal
233 core/streamly-core.cabal
232 core/jsbits/clock.js
234 core/jsbits/clock.js
233 core/Setup.hs
235 core/Setup.hs
@@ -496,9 +498,6 @@ library
496 , Streamly.Internal.FileSystem.Dir
498 , Streamly.Internal.FileSystem.Dir
497 , Streamly.Internal.FileSystem.File
499 , Streamly.Internal.FileSystem.File
498
500
499− -- streamly-console
500− , Streamly.Internal.Console.Stdio
501−
502 -- streamly-network
501 -- streamly-network
503 , Streamly.Internal.Network.Socket
502 , Streamly.Internal.Network.Socket
504 , Streamly.Internal.Network.Inet.TCP
503 , Streamly.Internal.Network.Inet.TCP
@@ -506,9 +505,6 @@ library
506 -- Exposed modules
505 -- Exposed modules
507 , Streamly.Prelude
506 , Streamly.Prelude
508
507
509− -- Filesystem/IO
510− , Streamly.Console.Stdio
511−
512 -- Network/IO
508 -- Network/IO
513 , Streamly.Network.Socket
509 , Streamly.Network.Socket
514 , Streamly.Network.Inet.TCP
510 , Streamly.Network.Inet.TCP