streamly-0.7.3.1: Beautiful Streaming, Concurrent and Reactive Composition
Copyright(c) 2018 Composewell Technologies
LicenseBSD3
Maintainerstreamly@composewell.com
Stabilityexperimental
PortabilityGHC
Safe HaskellSafe-Inferred
LanguageHaskell2010

Streamly.Internal.Memory.Unicode.Array

Description

 
Synopsis

Streams of Strings

lines :: (MonadIO m, IsStream t) => t m Char -> t m (Array Char) Source #

Break a string up into a stream of strings at newline characters. The resulting strings do not contain newlines.

lines = S.lines A.write
>>> S.toList $ lines $ S.fromList "lines\nthis\nstring\n\n\n"
["lines","this","string","",""]

words :: (MonadIO m, IsStream t) => t m Char -> t m (Array Char) Source #

Break a string up into a stream of strings, which were delimited by characters representing white space.

words = S.words A.write
>>> S.toList $ words $ S.fromList "A  newline\nis considered white space?"
["A", "newline", "is", "considered", "white", "space?"]

unlines :: (MonadIO m, IsStream t) => t m (Array Char) -> t m Char Source #

Flattens the stream of Array Char, after appending a terminating newline to each string.

unlines is an inverse operation to lines.

>>> S.toList $ unlines $ S.fromList ["lines", "this", "string"]
"lines\nthis\nstring\n"
unlines = S.unlines A.read

Note that, in general

unlines . lines /= id

unwords :: (MonadAsync m, IsStream t) => t m (Array Char) -> t m Char Source #

Flattens the stream of Array Char, after appending a separating space to each string.

unwords is an inverse operation to words.

>>> S.toList $ unwords $ S.fromList ["unwords", "this", "string"]
"unwords this string"
unwords = S.unwords A.read

Note that, in general

unwords . words /= id