2-- Module : Streamly.String
3-- Copyright : (c) 2018 Composewell Technologies
6-- Maintainer : harendra.kumar@gmail.com
7-- Stability : experimental
10-- Strings are simply character streams. Stream of 'Char' are the equivalent of
11-- Haskell Strings but without any performance issues that are usually
12-- associated with the 'String' type. We can use the usual stream processing
13-- routines in these 'Char' streams. The processing of streams is very
14-- efficient in terms of CPU and space usage. Streamly employs stream fusion
15-- which makes all the stream operations extremely fast.
17-- The 'String' type in this module is just a synonym for the type @List Char@.
18-- It provides better performance compared to the standard Haskell @String@
19-- type and can be used almost as a drop-in replacement, especially when used
20-- with @OverloadedStrings@ extension, with little differences.
22-- See "Streamly.List", <src/docs/streamly-vs-lists.md> for more details and
23-- <src/test/PureStreams.hs> for comprehensive usage examples.
25-- TBD write a note on performance comparison with text, bytestrings, lists and
30 -- * Encoding and Decoding
31 -- | Streams of 'Word8' read from a file handle can be decoded into a
32 -- stream of unicode characters, similalrly before we write unicode text to
33 -- a file we can use an encoding routine to convert it to a stream of bytes
40 -- * Unicode aware operations
46 -- * Operations on character strings
47 , strip -- (dropAround isSpace)
60-- import Data.Word (Word8)
61-- import Streamly (IsStream)
62import Streamly.List (List)
63import Prelude hiding (String, lines, words, unlines, unwords)
64-- import Streamly.Fold (Fold)
65-- import Streamly.Array (Array)
67type String = List Char
69-------------------------------------------------------------------------------
70-- Encoding/Decoding Characters
71-------------------------------------------------------------------------------
73-- decodeWith :: TextEncoding -> t m Word8 -> t m Char
74-- decodeWith = undefined
76-------------------------------------------------------------------------------
77-- Encoding/Decoding Unicode Characters
78-------------------------------------------------------------------------------
81-- | Decode a UTF-8 encoded bytestream to a stream of Unicode characters.
82decodeUtf8 :: IsStream t => t m Word8 -> t m Char
85-- | Encode a stream of Unicode characters to a UTF-8 encoded bytestream.
86encodeUtf8 :: IsStream t => t m Char -> t m Word8
89-------------------------------------------------------------------------------
90-- Unicode aware operations on strings
91-------------------------------------------------------------------------------
93toCaseFold :: IsStream t => t m Char -> t m Char
96toLower :: IsStream t => t m Char -> t m Char
99toUpper :: IsStream t => t m Char -> t m Char
102toTitle :: IsStream t => t m Char -> t m Char
105-------------------------------------------------------------------------------
106-- Utility operations on strings
107-------------------------------------------------------------------------------
109strip :: IsStream t => t m Char -> t m Char
112stripStart :: IsStream t => t m Char -> t m Char
113stripStart = undefined
115stripEnd :: IsStream t => t m Char -> t m Char
118foldLines :: IsStream t => t m Char -> Fold m Char b -> t m b
121foldWords :: IsStream t => t m Char -> Fold m Char b -> t m b
124lines :: IsStream t => t m Char -> t m (Array Char)
127words :: IsStream t => t m Char -> t m (Array Char)
130unlines :: IsStream t => t m (Array Char) -> t m Char
133unwords :: IsStream t => t m (Array Char) -> t m Char
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