2-- Module : Streamly.Internal.Unicode.Array.Prim.Pinned
3-- Copyright : (c) 2020 Composewell Technologies
5-- License : BSD-3-Clause
6-- Maintainer : streamly@composewell.com
7-- Stability : experimental
10module Streamly.Internal.Unicode.Array.Prim.Pinned
12 -- * Streams of Strings
20import Control.Monad.IO.Class (MonadIO(..))
21import Streamly.Prelude (MonadAsync)
22import Prelude hiding (String, lines, words, unlines, unwords)
23import Streamly.Internal.Data.Stream.IsStream (IsStream)
24import Streamly.Internal.Data.Array.Prim.Pinned (Array)
26import qualified Streamly.Internal.Unicode.Stream as S
27import qualified Streamly.Internal.Data.Array.Prim.Pinned as A
29-- | Break a string up into a stream of strings at newline characters.
30-- The resulting strings do not contain newlines.
32-- > lines = S.lines A.write
34-- >>> S.toList $ lines $ S.fromList "lines\nthis\nstring\n\n\n"
35-- ["lines","this","string","",""]
38lines :: (MonadIO m, IsStream t) => t m Char -> t m (Array Char)
39lines = S.lines A.write
41-- | Break a string up into a stream of strings, which were delimited
42-- by characters representing white space.
44-- > words = S.words A.write
46-- >>> S.toList $ words $ S.fromList "A newline\nis considered white space?"
47-- ["A", "newline", "is", "considered", "white", "space?"]
50words :: (MonadIO m, IsStream t) => t m Char -> t m (Array Char)
51words = S.words A.write
53-- | Flattens the stream of @Array Char@, after appending a terminating
54-- newline to each string.
56-- 'unlines' is an inverse operation to 'lines'.
58-- >>> S.toList $ unlines $ S.fromList ["lines", "this", "string"]
59-- "lines\nthis\nstring\n"
61-- > unlines = S.unlines A.read
63-- Note that, in general
65-- > unlines . lines /= id
67unlines :: (MonadAsync m, IsStream t) => t m (Array Char) -> t m Char
68unlines = S.unlines A.read
70-- | Flattens the stream of @Array Char@, after appending a separating
71-- space to each string.
73-- 'unwords' is an inverse operation to 'words'.
75-- >>> S.toList $ unwords $ S.fromList ["unwords", "this", "string"]
76-- "unwords this string"
78-- > unwords = S.unwords A.read
80-- Note that, in general
82-- > unwords . words /= id
84unwords :: (MonadAsync m, IsStream t) => t m (Array Char) -> t m Char
85unwords = S.unwords A.read
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list