@@ -59,6 +59,7 @@ module Streamly.Internal.FileSystem.Handle
5959 , fromChunksWithBufferOf
6060 , fromChunks
6161 , putChunks
62+ , putStrings
6263
6364 -- -- * Random Access (Seek)
6465 -- -- | Unlike the streaming APIs listed above, these APIs apply to devices or
@@ -121,6 +122,7 @@ import Streamly.Streams.StreamK.Type (IsStream, mkStream)
121122
122123import qualified Streamly.Data.Fold as FL
123124import qualified Streamly.Internal.Data.Fold.Types as FL
125+import qualified Streamly.Internal.Data.Unicode.Stream as U
124126import qualified Streamly.Internal.Data.Unfold as UF
125127import qualified Streamly.Internal.Memory.ArrayStream as AS
126128import qualified Streamly.Internal.Prelude as S
@@ -342,6 +344,17 @@ fromChunks h m = S.mapM_ (liftIO . writeArray h) m
342344putChunks :: (MonadIO m, Storable a) => SerialT m (Array a) -> m ()
343345putChunks = fromChunks stdout
344346
347+-- XXX this is currently buffered with 32K buffer. We need to use a timeout
348+-- based scheme instead.
349+--
350+-- | Write a stream of strings to standard output.
351+--
352+-- /Internal/
353+--
354+{-# INLINE putStrings #-}
355+putStrings :: MonadIO m => SerialT m String -> m ()
356+putStrings = fromBytes stdout . U.encodeUtf8 . S.concatUnfold UF.fromList
357+
345358-- | @fromChunksWithBufferOf bufsize handle stream@ writes a stream of arrays
346359-- to @handle@ after coalescing the adjacent arrays in chunks of @bufsize@.
347360-- The chunk size is only a maximum and the actual writes could be smaller as