{-# LANGUAGE FlexibleContexts #-}
module Streamly.Internal.Memory.Unicode.Array
(
lines
, words
, unlines
, unwords
)
where
import Control.Monad.IO.Class (MonadIO)
import Streamly (IsStream, MonadAsync)
import Prelude hiding (String, lines, words, unlines, unwords)
import Streamly.Memory.Array (Array)
import qualified Streamly.Internal.Data.Unicode.Stream as S
import qualified Streamly.Memory.Array as A
{-# INLINE lines #-}
lines :: (MonadIO m, IsStream t) => t m Char -> t m (Array Char)
lines :: t m Char -> t m (Array Char)
lines = Fold m Char (Array Char) -> t m Char -> t m (Array Char)
forall (m :: * -> *) (t :: (* -> *) -> * -> *) b.
(Monad m, IsStream t) =>
Fold m Char b -> t m Char -> t m b
S.lines Fold m Char (Array Char)
forall (m :: * -> *) a.
(MonadIO m, Storable a) =>
Fold m a (Array a)
A.write
{-# INLINE words #-}
words :: (MonadIO m, IsStream t) => t m Char -> t m (Array Char)
words :: t m Char -> t m (Array Char)
words = Fold m Char (Array Char) -> t m Char -> t m (Array Char)
forall (m :: * -> *) (t :: (* -> *) -> * -> *) b.
(Monad m, IsStream t) =>
Fold m Char b -> t m Char -> t m b
S.words Fold m Char (Array Char)
forall (m :: * -> *) a.
(MonadIO m, Storable a) =>
Fold m a (Array a)
A.write
{-# INLINE unlines #-}
unlines :: (MonadIO m, IsStream t) => t m (Array Char) -> t m Char
unlines :: t m (Array Char) -> t m Char
unlines = Unfold m (Array Char) Char -> t m (Array Char) -> t m Char
forall (m :: * -> *) (t :: (* -> *) -> * -> *) a.
(MonadIO m, IsStream t) =>
Unfold m a Char -> t m a -> t m Char
S.unlines Unfold m (Array Char) Char
forall (m :: * -> *) a.
(Monad m, Storable a) =>
Unfold m (Array a) a
A.read
{-# INLINE unwords #-}
unwords :: (MonadAsync m, IsStream t) => t m (Array Char) -> t m Char
unwords :: t m (Array Char) -> t m Char
unwords = Unfold m (Array Char) Char -> t m (Array Char) -> t m Char
forall (m :: * -> *) (t :: (* -> *) -> * -> *) a.
(MonadIO m, IsStream t) =>
Unfold m a Char -> t m a -> t m Char
S.unwords Unfold m (Array Char) Char
forall (m :: * -> *) a.
(Monad m, Storable a) =>
Unfold m (Array a) a
A.read