This file is indexed.

/usr/share/doc/libghc-text-doc/html/Data-Text-Lazy.html is in libghc-text-doc 1.2.2.0-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Data.Text.Lazy</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
window.onload = function () {pageLoad();setSynopsis("mini_Data-Text-Lazy.html");};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="src/Data-Text-Lazy.html">Source</a></li><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">text-1.2.2.0: An efficient packed Unicode text type.</p></div><div id="content"><div id="module-header"><table class="info"><tr><th>Copyright</th><td>(c) 2009, 2010, 2012 Bryan O'Sullivan</td></tr><tr><th>License</th><td>BSD-style</td></tr><tr><th>Maintainer</th><td>bos@serpentine.com</td></tr><tr><th>Stability</th><td>experimental</td></tr><tr><th>Portability</th><td>GHC</td></tr><tr><th>Safe Haskell</th><td>Trustworthy</td></tr><tr><th>Language</th><td>Haskell98</td></tr></table><p class="caption">Data.Text.Lazy</p></div><div id="table-of-contents"><p class="caption">Contents</p><ul><li><a href="#g:1">Fusion</a></li><li><a href="#g:2">Acceptable data</a></li><li><a href="#g:3">Types</a></li><li><a href="#g:4">Creation and elimination</a></li><li><a href="#g:5">Basic interface</a></li><li><a href="#g:6">Transformations</a><ul><li><a href="#g:7">Case conversion</a></li><li><a href="#g:8">Justification</a></li></ul></li><li><a href="#g:9">Folds</a><ul><li><a href="#g:10">Special folds</a></li></ul></li><li><a href="#g:11">Construction</a><ul><li><a href="#g:12">Scans</a></li><li><a href="#g:13">Accumulating maps</a></li><li><a href="#g:14">Generation and unfolding</a></li></ul></li><li><a href="#g:15">Substrings</a><ul><li><a href="#g:16">Breaking strings</a></li><li><a href="#g:17">Breaking into many substrings</a></li><li><a href="#g:18">Breaking into lines and words</a></li></ul></li><li><a href="#g:19">Predicates</a><ul><li><a href="#g:20">View patterns</a></li></ul></li><li><a href="#g:21">Searching</a></li><li><a href="#g:22">Indexing</a></li><li><a href="#g:23">Zipping and unzipping</a></li></ul></div><div id="description"><p class="caption">Description</p><div class="doc"><p>A time and space-efficient implementation of Unicode text using
 lists of packed arrays.</p><p><em>Note</em>: Read below the synopsis for important notes on the use of
 this module.</p><p>The representation used by this module is suitable for high
 performance use and for streaming large quantities of data.  It
 provides a means to manipulate a large body of text without
 requiring that the entire content be resident in memory.</p><p>Some operations, such as <code><a href="Data-Text-Lazy.html#v:concat">concat</a></code>, <code><a href="Data-Text-Lazy.html#v:append">append</a></code>, <code><a href="Data-Text-Lazy.html#v:reverse">reverse</a></code> and <code><a href="Data-Text-Lazy.html#v:cons">cons</a></code>,
 have better time complexity than their <a href="Data-Text.html">Data.Text</a> equivalents, due
 to the underlying representation being a list of chunks. For other
 operations, lazy <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code>s are usually within a few percent of strict
 ones, but often with better heap usage if used in a streaming
 fashion. For data larger than available memory, or if you have
 tight memory constraints, this module will be the only option.</p><p>This module is intended to be imported <code>qualified</code>, to avoid name
 clashes with <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Prelude.html">Prelude</a> functions.  eg.</p><pre>import qualified Data.Text.Lazy as L</pre></div></div><div id="synopsis"><p id="control.syn" class="caption expander" onclick="toggleSection('syn')">Synopsis</p><ul id="section.syn" class="hide" onclick="toggleSection('syn')"><li class="src short"><span class="keyword">data</span> <a href="#t:Text">Text</a></li><li class="src short"><a href="#v:pack">pack</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-String.html#t:String">String</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:unpack">unpack</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-String.html#t:String">String</a></li><li class="src short"><a href="#v:singleton">singleton</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:empty">empty</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:fromChunks">fromChunks</a> :: [<a href="Data-Text.html#t:Text">Text</a>] -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:toChunks">toChunks</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; [<a href="Data-Text.html#t:Text">Text</a>]</li><li class="src short"><a href="#v:toStrict">toStrict</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a></li><li class="src short"><a href="#v:fromStrict">fromStrict</a> :: <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:foldrChunks">foldrChunks</a> :: (<a href="Data-Text.html#t:Text">Text</a> -&gt; a -&gt; a) -&gt; a -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; a</li><li class="src short"><a href="#v:foldlChunks">foldlChunks</a> :: (a -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; a) -&gt; a -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; a</li><li class="src short"><a href="#v:cons">cons</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:snoc">snoc</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:append">append</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:uncons">uncons</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Maybe.html#t:Maybe">Maybe</a> (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a>, <a href="Data-Text-Lazy.html#t:Text">Text</a>)</li><li class="src short"><a href="#v:head">head</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a></li><li class="src short"><a href="#v:last">last</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a></li><li class="src short"><a href="#v:tail">tail</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:init">init</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:null">null</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><a href="#v:length">length</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Int.html#t:Int64">Int64</a></li><li class="src short"><a href="#v:compareLength">compareLength</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Int.html#t:Int64">Int64</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Ord.html#t:Ordering">Ordering</a></li><li class="src short"><a href="#v:map">map</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a>) -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:intercalate">intercalate</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; [<a href="Data-Text-Lazy.html#t:Text">Text</a>] -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:intersperse">intersperse</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:transpose">transpose</a> :: [<a href="Data-Text-Lazy.html#t:Text">Text</a>] -&gt; [<a href="Data-Text-Lazy.html#t:Text">Text</a>]</li><li class="src short"><a href="#v:reverse">reverse</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:replace">replace</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:toCaseFold">toCaseFold</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:toLower">toLower</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:toUpper">toUpper</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:toTitle">toTitle</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:justifyLeft">justifyLeft</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Int.html#t:Int64">Int64</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:justifyRight">justifyRight</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Int.html#t:Int64">Int64</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:center">center</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Int.html#t:Int64">Int64</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:foldl">foldl</a> :: (a -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -&gt; a) -&gt; a -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; a</li><li class="src short"><a href="#v:foldl-39-">foldl'</a> :: (a -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -&gt; a) -&gt; a -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; a</li><li class="src short"><a href="#v:foldl1">foldl1</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a>) -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a></li><li class="src short"><a href="#v:foldl1-39-">foldl1'</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a>) -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a></li><li class="src short"><a href="#v:foldr">foldr</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -&gt; a -&gt; a) -&gt; a -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; a</li><li class="src short"><a href="#v:foldr1">foldr1</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a>) -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a></li><li class="src short"><a href="#v:concat">concat</a> :: [<a href="Data-Text-Lazy.html#t:Text">Text</a>] -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:concatMap">concatMap</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a>) -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:any">any</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Bool.html#t:Bool">Bool</a>) -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><a href="#v:all">all</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Bool.html#t:Bool">Bool</a>) -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><a href="#v:maximum">maximum</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a></li><li class="src short"><a href="#v:minimum">minimum</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a></li><li class="src short"><a href="#v:scanl">scanl</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a>) -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:scanl1">scanl1</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a>) -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:scanr">scanr</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a>) -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:scanr1">scanr1</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a>) -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:mapAccumL">mapAccumL</a> :: (a -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -&gt; (a, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a>)) -&gt; a -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; (a, <a href="Data-Text-Lazy.html#t:Text">Text</a>)</li><li class="src short"><a href="#v:mapAccumR">mapAccumR</a> :: (a -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -&gt; (a, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a>)) -&gt; a -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; (a, <a href="Data-Text-Lazy.html#t:Text">Text</a>)</li><li class="src short"><a href="#v:repeat">repeat</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:replicate">replicate</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Int.html#t:Int64">Int64</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:cycle">cycle</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:iterate">iterate</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a>) -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:unfoldr">unfoldr</a> :: (a -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Maybe.html#t:Maybe">Maybe</a> (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a>, a)) -&gt; a -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:unfoldrN">unfoldrN</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Int.html#t:Int64">Int64</a> -&gt; (a -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Maybe.html#t:Maybe">Maybe</a> (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a>, a)) -&gt; a -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:take">take</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Int.html#t:Int64">Int64</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:takeEnd">takeEnd</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Int.html#t:Int64">Int64</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:drop">drop</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Int.html#t:Int64">Int64</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:dropEnd">dropEnd</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Int.html#t:Int64">Int64</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:takeWhile">takeWhile</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Bool.html#t:Bool">Bool</a>) -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:takeWhileEnd">takeWhileEnd</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Bool.html#t:Bool">Bool</a>) -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:dropWhile">dropWhile</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Bool.html#t:Bool">Bool</a>) -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:dropWhileEnd">dropWhileEnd</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Bool.html#t:Bool">Bool</a>) -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:dropAround">dropAround</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Bool.html#t:Bool">Bool</a>) -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:strip">strip</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:stripStart">stripStart</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:stripEnd">stripEnd</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:splitAt">splitAt</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Int.html#t:Int64">Int64</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; (<a href="Data-Text-Lazy.html#t:Text">Text</a>, <a href="Data-Text-Lazy.html#t:Text">Text</a>)</li><li class="src short"><a href="#v:span">span</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Bool.html#t:Bool">Bool</a>) -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; (<a href="Data-Text-Lazy.html#t:Text">Text</a>, <a href="Data-Text-Lazy.html#t:Text">Text</a>)</li><li class="src short"><a href="#v:breakOn">breakOn</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; (<a href="Data-Text-Lazy.html#t:Text">Text</a>, <a href="Data-Text-Lazy.html#t:Text">Text</a>)</li><li class="src short"><a href="#v:breakOnEnd">breakOnEnd</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; (<a href="Data-Text-Lazy.html#t:Text">Text</a>, <a href="Data-Text-Lazy.html#t:Text">Text</a>)</li><li class="src short"><a href="#v:break">break</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Bool.html#t:Bool">Bool</a>) -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; (<a href="Data-Text-Lazy.html#t:Text">Text</a>, <a href="Data-Text-Lazy.html#t:Text">Text</a>)</li><li class="src short"><a href="#v:group">group</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; [<a href="Data-Text-Lazy.html#t:Text">Text</a>]</li><li class="src short"><a href="#v:groupBy">groupBy</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Bool.html#t:Bool">Bool</a>) -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; [<a href="Data-Text-Lazy.html#t:Text">Text</a>]</li><li class="src short"><a href="#v:inits">inits</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; [<a href="Data-Text-Lazy.html#t:Text">Text</a>]</li><li class="src short"><a href="#v:tails">tails</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; [<a href="Data-Text-Lazy.html#t:Text">Text</a>]</li><li class="src short"><a href="#v:splitOn">splitOn</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; [<a href="Data-Text-Lazy.html#t:Text">Text</a>]</li><li class="src short"><a href="#v:split">split</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Bool.html#t:Bool">Bool</a>) -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; [<a href="Data-Text-Lazy.html#t:Text">Text</a>]</li><li class="src short"><a href="#v:chunksOf">chunksOf</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Int.html#t:Int64">Int64</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; [<a href="Data-Text-Lazy.html#t:Text">Text</a>]</li><li class="src short"><a href="#v:lines">lines</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; [<a href="Data-Text-Lazy.html#t:Text">Text</a>]</li><li class="src short"><a href="#v:words">words</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; [<a href="Data-Text-Lazy.html#t:Text">Text</a>]</li><li class="src short"><a href="#v:unlines">unlines</a> :: [<a href="Data-Text-Lazy.html#t:Text">Text</a>] -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:unwords">unwords</a> :: [<a href="Data-Text-Lazy.html#t:Text">Text</a>] -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:isPrefixOf">isPrefixOf</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><a href="#v:isSuffixOf">isSuffixOf</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><a href="#v:isInfixOf">isInfixOf</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><a href="#v:stripPrefix">stripPrefix</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:stripSuffix">stripSuffix</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:commonPrefixes">commonPrefixes</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Maybe.html#t:Maybe">Maybe</a> (<a href="Data-Text-Lazy.html#t:Text">Text</a>, <a href="Data-Text-Lazy.html#t:Text">Text</a>, <a href="Data-Text-Lazy.html#t:Text">Text</a>)</li><li class="src short"><a href="#v:filter">filter</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Bool.html#t:Bool">Bool</a>) -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:find">find</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Bool.html#t:Bool">Bool</a>) -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a></li><li class="src short"><a href="#v:breakOnAll">breakOnAll</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; [(<a href="Data-Text-Lazy.html#t:Text">Text</a>, <a href="Data-Text-Lazy.html#t:Text">Text</a>)]</li><li class="src short"><a href="#v:partition">partition</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Bool.html#t:Bool">Bool</a>) -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; (<a href="Data-Text-Lazy.html#t:Text">Text</a>, <a href="Data-Text-Lazy.html#t:Text">Text</a>)</li><li class="src short"><a href="#v:index">index</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Int.html#t:Int64">Int64</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a></li><li class="src short"><a href="#v:count">count</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Int.html#t:Int64">Int64</a></li><li class="src short"><a href="#v:zip">zip</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; [(<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a>, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a>)]</li><li class="src short"><a href="#v:zipWith">zipWith</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a>) -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a></li></ul></div><div id="interface"><h1 id="g:1">Fusion</h1><div class="doc"><p>Most of the functions in this module are subject to <em>fusion</em>,
 meaning that a pipeline of such functions will usually allocate at
 most one <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code> value.</p><p>As an example, consider the following pipeline:</p><pre>import Data.Text.Lazy as T
import Data.Text.Lazy.Encoding as E
import Data.ByteString.Lazy (ByteString)

countChars :: ByteString -&gt; Int
countChars = T.length . T.toUpper . E.decodeUtf8</pre><p>From the type signatures involved, this looks like it should
 allocate one <code>ByteString</code> value, and two <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code> values. However,
 when a module is compiled with optimisation enabled under GHC, the
 two intermediate <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code> values will be optimised away, and the
 function will be compiled down to a single loop over the source
 <code>ByteString</code>.</p><p>Functions that can be fused by the compiler are documented with the
 phrase &quot;Subject to fusion&quot;.</p></div><h1 id="g:2">Acceptable data</h1><div class="doc"><p>A <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code> value is a sequence of Unicode scalar values, as defined
 in &#167;3.9, definition D76 of the Unicode 5.2 standard:
 <a href="http://www.unicode.org/versions/Unicode5.2.0/ch03.pdf#page=35">http://www.unicode.org/versions/Unicode5.2.0/ch03.pdf#page=35</a>. As
 such, a <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code> cannot contain values in the range U+D800 to U+DFFF
 inclusive. Haskell implementations admit all Unicode code points
 (&#167;3.4, definition D10) as <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a></code> values, including code points
 from this invalid range.  This means that there are some <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a></code>
 values that are not valid Unicode scalar values, and the functions
 in this module must handle those cases.</p><p>Within this module, many functions construct a <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code> from one or
 more <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a></code> values. Those functions will substitute <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a></code> values
 that are not valid Unicode scalar values with the replacement
 character &quot;&#65533;&quot; (U+FFFD).  Functions that perform this
 inspection and replacement are documented with the phrase
 &quot;Performs replacement on invalid scalar values&quot;.</p><p>(One reason for this policy of replacement is that internally, a
 <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code> value is represented as packed UTF-16 data. Values in the
 range U+D800 through U+DFFF are used by UTF-16 to denote surrogate
 code points, and so cannot be represented. The functions replace
 invalid scalar values, instead of dropping them, as a security
 measure. For details, see Unicode Technical Report 36, &#167;3.5:
 <a href="http://unicode.org/reports/tr36#Deletion_of_Noncharacters">http://unicode.org/reports/tr36#Deletion_of_Noncharacters</a>)</p></div><h1 id="g:3">Types</h1><div class="top"><p class="src"><span class="keyword">data</span> <a name="t:Text" class="def">Text</a> <a href="src/Data-Text-Internal-Lazy.html#Text" class="link">Source</a></p><div class="subs instances"><p id="control.i:Text" class="caption collapser" onclick="toggleSection('i:Text')">Instances</p><div id="section.i:Text" class="show"><table><tr><td class="src clearfix"><span class="inst-left"><span class="keyword">type</span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/GHC-Exts.html#t:Item">Item</a> <a href="Data-Text-Lazy.html#t:Text">Text</a> = <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a></span></td><td class="doc empty">&nbsp;</td></tr></table></div></div></div><h1 id="g:4">Creation and elimination</h1><div class="top"><p class="src"><a name="v:pack" class="def">pack</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-String.html#t:String">String</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Lazy.html#pack" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Convert a <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-String.html#t:String">String</a></code> into a <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code>.</p><p>Subject to fusion.  Performs replacement on invalid scalar values.</p></div></div><div class="top"><p class="src"><a name="v:unpack" class="def">unpack</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-String.html#t:String">String</a> <a href="src/Data-Text-Lazy.html#unpack" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Convert a <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code> into a <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-String.html#t:String">String</a></code>.
 Subject to fusion.</p></div></div><div class="top"><p class="src"><a name="v:singleton" class="def">singleton</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Lazy.html#singleton" class="link">Source</a></p><div class="doc"><p><em>O(1)</em> Convert a character into a Text.  Subject to fusion.
 Performs replacement on invalid scalar values.</p></div></div><div class="top"><p class="src"><a name="v:empty" class="def">empty</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Internal-Lazy.html#empty" class="link">Source</a></p><div class="doc"><p>Smart constructor for <code><a href="Data-Text-Internal-Lazy.html#v:Empty">Empty</a></code>.</p></div></div><div class="top"><p class="src"><a name="v:fromChunks" class="def">fromChunks</a> :: [<a href="Data-Text.html#t:Text">Text</a>] -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Lazy.html#fromChunks" class="link">Source</a></p><div class="doc"><p><em>O(c)</em> Convert a list of strict <code><a href="Data-Text.html#t:Text">Text</a></code>s into a lazy <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code>.</p></div></div><div class="top"><p class="src"><a name="v:toChunks" class="def">toChunks</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; [<a href="Data-Text.html#t:Text">Text</a>] <a href="src/Data-Text-Lazy.html#toChunks" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Convert a lazy <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code> into a list of strict <code><a href="Data-Text.html#t:Text">Text</a></code>s.</p></div></div><div class="top"><p class="src"><a name="v:toStrict" class="def">toStrict</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a> <a href="src/Data-Text-Lazy.html#toStrict" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Convert a lazy <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code> into a strict <code><a href="Data-Text.html#t:Text">Text</a></code>.</p></div></div><div class="top"><p class="src"><a name="v:fromStrict" class="def">fromStrict</a> :: <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Lazy.html#fromStrict" class="link">Source</a></p><div class="doc"><p><em>O(c)</em> Convert a strict <code><a href="Data-Text.html#t:Text">Text</a></code> into a lazy <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code>.</p></div></div><div class="top"><p class="src"><a name="v:foldrChunks" class="def">foldrChunks</a> :: (<a href="Data-Text.html#t:Text">Text</a> -&gt; a -&gt; a) -&gt; a -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; a <a href="src/Data-Text-Internal-Lazy.html#foldrChunks" class="link">Source</a></p><div class="doc"><p>Consume the chunks of a lazy <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code> with a natural right fold.</p></div></div><div class="top"><p class="src"><a name="v:foldlChunks" class="def">foldlChunks</a> :: (a -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; a) -&gt; a -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; a <a href="src/Data-Text-Internal-Lazy.html#foldlChunks" class="link">Source</a></p><div class="doc"><p>Consume the chunks of a lazy <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code> with a strict, tail-recursive,
 accumulating left fold.</p></div></div><h1 id="g:5">Basic interface</h1><div class="top"><p class="src"><a name="v:cons" class="def">cons</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> <span class="fixity">infixr 5</span><span class="rightedge"></span> <a href="src/Data-Text-Lazy.html#cons" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Adds a character to the front of a <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code>.  This function
 is more costly than its <code>List</code> counterpart because it requires
 copying a new array.  Subject to fusion.</p></div></div><div class="top"><p class="src"><a name="v:snoc" class="def">snoc</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Lazy.html#snoc" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Adds a character to the end of a <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code>.  This copies the
 entire array in the process, unless fused.  Subject to fusion.</p></div></div><div class="top"><p class="src"><a name="v:append" class="def">append</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Lazy.html#append" class="link">Source</a></p><div class="doc"><p><em>O(n/c)</em> Appends one <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code> to another.  Subject to fusion.</p></div></div><div class="top"><p class="src"><a name="v:uncons" class="def">uncons</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Maybe.html#t:Maybe">Maybe</a> (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a>, <a href="Data-Text-Lazy.html#t:Text">Text</a>) <a href="src/Data-Text-Lazy.html#uncons" class="link">Source</a></p><div class="doc"><p><em>O(1)</em> Returns the first character and rest of a <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code>, or
 <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Maybe.html#v:Nothing">Nothing</a></code> if empty. Subject to fusion.</p></div></div><div class="top"><p class="src"><a name="v:head" class="def">head</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> <a href="src/Data-Text-Lazy.html#head" class="link">Source</a></p><div class="doc"><p><em>O(1)</em> Returns the first character of a <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code>, which must be
 non-empty.  Subject to fusion.</p></div></div><div class="top"><p class="src"><a name="v:last" class="def">last</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> <a href="src/Data-Text-Lazy.html#last" class="link">Source</a></p><div class="doc"><p><em>O(1)</em> Returns the last character of a <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code>, which must be
 non-empty.  Subject to fusion.</p></div></div><div class="top"><p class="src"><a name="v:tail" class="def">tail</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Lazy.html#tail" class="link">Source</a></p><div class="doc"><p><em>O(1)</em> Returns all characters after the head of a <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code>, which
 must be non-empty.  Subject to fusion.</p></div></div><div class="top"><p class="src"><a name="v:init" class="def">init</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Lazy.html#init" class="link">Source</a></p><div class="doc"><p><em>O(1)</em> Returns all but the last character of a <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code>, which must
 be non-empty.  Subject to fusion.</p></div></div><div class="top"><p class="src"><a name="v:null" class="def">null</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Bool.html#t:Bool">Bool</a> <a href="src/Data-Text-Lazy.html#null" class="link">Source</a></p><div class="doc"><p><em>O(1)</em> Tests whether a <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code> is empty or not.  Subject to
 fusion.</p></div></div><div class="top"><p class="src"><a name="v:length" class="def">length</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Int.html#t:Int64">Int64</a> <a href="src/Data-Text-Lazy.html#length" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Returns the number of characters in a <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code>.
 Subject to fusion.</p></div></div><div class="top"><p class="src"><a name="v:compareLength" class="def">compareLength</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Int.html#t:Int64">Int64</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Ord.html#t:Ordering">Ordering</a> <a href="src/Data-Text-Lazy.html#compareLength" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Compare the count of characters in a <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code> to a number.
 Subject to fusion.</p><p>This function gives the same answer as comparing against the result
 of <code><a href="Data-Text-Lazy.html#v:length">length</a></code>, but can short circuit if the count of characters is
 greater than the number, and hence be more efficient.</p></div></div><h1 id="g:6">Transformations</h1><div class="top"><p class="src"><a name="v:map" class="def">map</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a>) -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Lazy.html#map" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> <code><a href="Data-Text-Lazy.html#v:map">map</a></code> <code>f</code> <code>t</code> is the <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code> obtained by applying <code>f</code> to
 each element of <code>t</code>.  Subject to fusion.  Performs replacement on
 invalid scalar values.</p></div></div><div class="top"><p class="src"><a name="v:intercalate" class="def">intercalate</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; [<a href="Data-Text-Lazy.html#t:Text">Text</a>] -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Lazy.html#intercalate" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> The <code><a href="Data-Text-Lazy.html#v:intercalate">intercalate</a></code> function takes a <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code> and a list of
 <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code>s and concatenates the list after interspersing the first
 argument between each element of the list.</p></div></div><div class="top"><p class="src"><a name="v:intersperse" class="def">intersperse</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Lazy.html#intersperse" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> The <code><a href="Data-Text-Lazy.html#v:intersperse">intersperse</a></code> function takes a character and places it
 between the characters of a <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code>.  Subject to fusion.  Performs
 replacement on invalid scalar values.</p></div></div><div class="top"><p class="src"><a name="v:transpose" class="def">transpose</a> :: [<a href="Data-Text-Lazy.html#t:Text">Text</a>] -&gt; [<a href="Data-Text-Lazy.html#t:Text">Text</a>] <a href="src/Data-Text-Lazy.html#transpose" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> The <code><a href="Data-Text-Lazy.html#v:transpose">transpose</a></code> function transposes the rows and columns
 of its <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code> argument.  Note that this function uses <code><a href="Data-Text-Lazy.html#v:pack">pack</a></code>,
 <code><a href="Data-Text-Lazy.html#v:unpack">unpack</a></code>, and the list version of transpose, and is thus not very
 efficient.</p></div></div><div class="top"><p class="src"><a name="v:reverse" class="def">reverse</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Lazy.html#reverse" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> <code><a href="Data-Text-Lazy.html#v:reverse">reverse</a></code> <code>t</code> returns the elements of <code>t</code> in reverse order.</p></div></div><div class="top"><p class="src"><a name="v:replace" class="def">replace</a> <a href="src/Data-Text-Lazy.html#replace" class="link">Source</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: <a href="Data-Text-Lazy.html#t:Text">Text</a></td><td class="doc"><p><code>needle</code> to search for.  If this string is empty, an
 error will occur.</p></td></tr><tr><td class="src">-&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a></td><td class="doc"><p><code>replacement</code> to replace <code>needle</code> with.</p></td></tr><tr><td class="src">-&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a></td><td class="doc"><p><code>haystack</code> in which to search.</p></td></tr><tr><td class="src">-&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a></td><td class="doc empty">&nbsp;</td></tr></table></div><div class="doc"><p><em>O(m+n)</em> Replace every non-overlapping occurrence of <code>needle</code> in
 <code>haystack</code> with <code>replacement</code>.</p><p>This function behaves as though it was defined as follows:</p><pre>replace needle replacement haystack =
  <code><a href="Data-Text-Lazy.html#v:intercalate">intercalate</a></code> replacement (<code><a href="Data-Text-Lazy.html#v:splitOn">splitOn</a></code> needle haystack)
</pre><p>As this suggests, each occurrence is replaced exactly once.  So if
 <code>needle</code> occurs in <code>replacement</code>, that occurrence will <em>not</em> itself
 be replaced recursively:</p><pre>replace &quot;oo&quot; &quot;foo&quot; &quot;oo&quot; == &quot;foo&quot;</pre><p>In cases where several instances of <code>needle</code> overlap, only the
 first one will be replaced:</p><pre>replace &quot;ofo&quot; &quot;bar&quot; &quot;ofofo&quot; == &quot;barfo&quot;</pre><p>In (unlikely) bad cases, this function's time complexity degrades
 towards <em>O(n*m)</em>.</p></div></div><h2 id="g:7">Case conversion</h2><div class="doc"><p>With Unicode text, it is incorrect to use combinators like <code>map
 toUpper</code> to case convert each character of a string individually.
 Instead, use the whole-string case conversion functions from this
 module.  For correctness in different writing systems, these
 functions may map one input character to two or three output
 characters.</p></div><div class="top"><p class="src"><a name="v:toCaseFold" class="def">toCaseFold</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Lazy.html#toCaseFold" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Convert a string to folded case.  Subject to fusion.</p><p>This function is mainly useful for performing caseless (or case
 insensitive) string comparisons.</p><p>A string <code>x</code> is a caseless match for a string <code>y</code> if and only if:</p><pre>toCaseFold x == toCaseFold y</pre><p>The result string may be longer than the input string, and may
 differ from applying <code><a href="Data-Text-Lazy.html#v:toLower">toLower</a></code> to the input string.  For instance,
 the Armenian small ligature men now (U+FB13) is case folded to the
 bigram men now (U+0574 U+0576), while the micro sign (U+00B5) is
 case folded to the Greek small letter letter mu (U+03BC) instead of
 itself.</p></div></div><div class="top"><p class="src"><a name="v:toLower" class="def">toLower</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Lazy.html#toLower" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Convert a string to lower case, using simple case
 conversion.  Subject to fusion.</p><p>The result string may be longer than the input string.  For
 instance, the Latin capital letter I with dot above (U+0130) maps
 to the sequence Latin small letter i (U+0069) followed by combining
 dot above (U+0307).</p></div></div><div class="top"><p class="src"><a name="v:toUpper" class="def">toUpper</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Lazy.html#toUpper" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Convert a string to upper case, using simple case
 conversion.  Subject to fusion.</p><p>The result string may be longer than the input string.  For
 instance, the German eszett (U+00DF) maps to the two-letter
 sequence SS.</p></div></div><div class="top"><p class="src"><a name="v:toTitle" class="def">toTitle</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Lazy.html#toTitle" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Convert a string to title case, using simple case
 conversion.  Subject to fusion.</p><p>The first letter of the input is converted to title case, as is
 every subsequent letter that immediately follows a non-letter.
 Every letter that immediately follows another letter is converted
 to lower case.</p><p>The result string may be longer than the input string. For example,
 the Latin small ligature &#64258; (U+FB02) is converted to the
 sequence Latin capital letter F (U+0046) followed by Latin small
 letter l (U+006C).</p><p><em>Note</em>: this function does not take language or culture specific
 rules into account. For instance, in English, different style
 guides disagree on whether the book name &quot;The Hill of the Red
 Fox&quot; is correctly title cased&#8212;but this function will
 capitalize <em>every</em> word.</p></div></div><h2 id="g:8">Justification</h2><div class="top"><p class="src"><a name="v:justifyLeft" class="def">justifyLeft</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Int.html#t:Int64">Int64</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Lazy.html#justifyLeft" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Left-justify a string to the given length, using the
 specified fill character on the right. Subject to fusion.  Performs
 replacement on invalid scalar values.</p><p>Examples:</p><pre>justifyLeft 7 'x' &quot;foo&quot;    == &quot;fooxxxx&quot;
justifyLeft 3 'x' &quot;foobar&quot; == &quot;foobar&quot;</pre></div></div><div class="top"><p class="src"><a name="v:justifyRight" class="def">justifyRight</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Int.html#t:Int64">Int64</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Lazy.html#justifyRight" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Right-justify a string to the given length, using the
 specified fill character on the left.  Performs replacement on
 invalid scalar values.</p><p>Examples:</p><pre>justifyRight 7 'x' &quot;bar&quot;    == &quot;xxxxbar&quot;
justifyRight 3 'x' &quot;foobar&quot; == &quot;foobar&quot;</pre></div></div><div class="top"><p class="src"><a name="v:center" class="def">center</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Int.html#t:Int64">Int64</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Lazy.html#center" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Center a string to the given length, using the specified
 fill character on either side.  Performs replacement on invalid
 scalar values.</p><p>Examples:</p><pre>center 8 'x' &quot;HS&quot; = &quot;xxxHSxxx&quot;</pre></div></div><h1 id="g:9">Folds</h1><div class="top"><p class="src"><a name="v:foldl" class="def">foldl</a> :: (a -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -&gt; a) -&gt; a -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; a <a href="src/Data-Text-Lazy.html#foldl" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> <code><a href="Data-Text-Lazy.html#v:foldl">foldl</a></code>, applied to a binary operator, a starting value
 (typically the left-identity of the operator), and a <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code>,
 reduces the <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code> using the binary operator, from left to right.
 Subject to fusion.</p></div></div><div class="top"><p class="src"><a name="v:foldl-39-" class="def">foldl'</a> :: (a -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -&gt; a) -&gt; a -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; a <a href="src/Data-Text-Lazy.html#foldl%27" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> A strict version of <code><a href="Data-Text-Lazy.html#v:foldl">foldl</a></code>.
 Subject to fusion.</p></div></div><div class="top"><p class="src"><a name="v:foldl1" class="def">foldl1</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a>) -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> <a href="src/Data-Text-Lazy.html#foldl1" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> A variant of <code><a href="Data-Text-Lazy.html#v:foldl">foldl</a></code> that has no starting value argument,
 and thus must be applied to a non-empty <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code>.  Subject to fusion.</p></div></div><div class="top"><p class="src"><a name="v:foldl1-39-" class="def">foldl1'</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a>) -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> <a href="src/Data-Text-Lazy.html#foldl1%27" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> A strict version of <code><a href="Data-Text-Lazy.html#v:foldl1">foldl1</a></code>.  Subject to fusion.</p></div></div><div class="top"><p class="src"><a name="v:foldr" class="def">foldr</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -&gt; a -&gt; a) -&gt; a -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; a <a href="src/Data-Text-Lazy.html#foldr" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> <code><a href="Data-Text-Lazy.html#v:foldr">foldr</a></code>, applied to a binary operator, a starting value
 (typically the right-identity of the operator), and a <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code>,
 reduces the <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code> using the binary operator, from right to left.
 Subject to fusion.</p></div></div><div class="top"><p class="src"><a name="v:foldr1" class="def">foldr1</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a>) -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> <a href="src/Data-Text-Lazy.html#foldr1" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> A variant of <code><a href="Data-Text-Lazy.html#v:foldr">foldr</a></code> that has no starting value argument,
 and thus must be applied to a non-empty <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code>.  Subject to
 fusion.</p></div></div><h2 id="g:10">Special folds</h2><div class="top"><p class="src"><a name="v:concat" class="def">concat</a> :: [<a href="Data-Text-Lazy.html#t:Text">Text</a>] -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Lazy.html#concat" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Concatenate a list of <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code>s.</p></div></div><div class="top"><p class="src"><a name="v:concatMap" class="def">concatMap</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a>) -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Lazy.html#concatMap" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Map a function over a <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code> that results in a <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code>, and
 concatenate the results.</p></div></div><div class="top"><p class="src"><a name="v:any" class="def">any</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Bool.html#t:Bool">Bool</a>) -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Bool.html#t:Bool">Bool</a> <a href="src/Data-Text-Lazy.html#any" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> <code><a href="Data-Text-Lazy.html#v:any">any</a></code> <code>p</code> <code>t</code> determines whether any character in the
 <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code> <code>t</code> satisfies the predicate <code>p</code>. Subject to fusion.</p></div></div><div class="top"><p class="src"><a name="v:all" class="def">all</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Bool.html#t:Bool">Bool</a>) -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Bool.html#t:Bool">Bool</a> <a href="src/Data-Text-Lazy.html#all" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> <code><a href="Data-Text-Lazy.html#v:all">all</a></code> <code>p</code> <code>t</code> determines whether all characters in the
 <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code> <code>t</code> satisfy the predicate <code>p</code>. Subject to fusion.</p></div></div><div class="top"><p class="src"><a name="v:maximum" class="def">maximum</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> <a href="src/Data-Text-Lazy.html#maximum" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> <code><a href="Data-Text-Lazy.html#v:maximum">maximum</a></code> returns the maximum value from a <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code>, which
 must be non-empty. Subject to fusion.</p></div></div><div class="top"><p class="src"><a name="v:minimum" class="def">minimum</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> <a href="src/Data-Text-Lazy.html#minimum" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> <code><a href="Data-Text-Lazy.html#v:minimum">minimum</a></code> returns the minimum value from a <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code>, which
 must be non-empty. Subject to fusion.</p></div></div><h1 id="g:11">Construction</h1><h2 id="g:12">Scans</h2><div class="top"><p class="src"><a name="v:scanl" class="def">scanl</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a>) -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Lazy.html#scanl" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> <code><a href="Data-Text-Lazy.html#v:scanl">scanl</a></code> is similar to <code><a href="Data-Text-Lazy.html#v:foldl">foldl</a></code>, but returns a list of
 successive reduced values from the left. Subject to fusion.
 Performs replacement on invalid scalar values.</p><pre>scanl f z [x1, x2, ...] == [z, z `f` x1, (z `f` x1) `f` x2, ...]</pre><p>Note that</p><pre>last (scanl f z xs) == foldl f z xs.</pre></div></div><div class="top"><p class="src"><a name="v:scanl1" class="def">scanl1</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a>) -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Lazy.html#scanl1" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> <code><a href="Data-Text-Lazy.html#v:scanl1">scanl1</a></code> is a variant of <code><a href="Data-Text-Lazy.html#v:scanl">scanl</a></code> that has no starting
 value argument.  Subject to fusion.  Performs replacement on
 invalid scalar values.</p><pre>scanl1 f [x1, x2, ...] == [x1, x1 `f` x2, ...]</pre></div></div><div class="top"><p class="src"><a name="v:scanr" class="def">scanr</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a>) -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Lazy.html#scanr" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> <code><a href="Data-Text-Lazy.html#v:scanr">scanr</a></code> is the right-to-left dual of <code><a href="Data-Text-Lazy.html#v:scanl">scanl</a></code>.  Performs
 replacement on invalid scalar values.</p><pre>scanr f v == reverse . scanl (flip f) v . reverse</pre></div></div><div class="top"><p class="src"><a name="v:scanr1" class="def">scanr1</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a>) -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Lazy.html#scanr1" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> <code><a href="Data-Text-Lazy.html#v:scanr1">scanr1</a></code> is a variant of <code><a href="Data-Text-Lazy.html#v:scanr">scanr</a></code> that has no starting
 value argument.  Performs replacement on invalid scalar values.</p></div></div><h2 id="g:13">Accumulating maps</h2><div class="top"><p class="src"><a name="v:mapAccumL" class="def">mapAccumL</a> :: (a -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -&gt; (a, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a>)) -&gt; a -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; (a, <a href="Data-Text-Lazy.html#t:Text">Text</a>) <a href="src/Data-Text-Lazy.html#mapAccumL" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Like a combination of <code><a href="Data-Text-Lazy.html#v:map">map</a></code> and <code><a href="Data-Text-Lazy.html#v:foldl-39-">foldl'</a></code>. Applies a
 function to each element of a <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code>, passing an accumulating
 parameter from left to right, and returns a final <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code>.  Performs
 replacement on invalid scalar values.</p></div></div><div class="top"><p class="src"><a name="v:mapAccumR" class="def">mapAccumR</a> :: (a -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -&gt; (a, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a>)) -&gt; a -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; (a, <a href="Data-Text-Lazy.html#t:Text">Text</a>) <a href="src/Data-Text-Lazy.html#mapAccumR" class="link">Source</a></p><div class="doc"><p>The <code><a href="Data-Text-Lazy.html#v:mapAccumR">mapAccumR</a></code> function behaves like a combination of <code><a href="Data-Text-Lazy.html#v:map">map</a></code> and
 a strict <code><a href="Data-Text-Lazy.html#v:foldr">foldr</a></code>; it applies a function to each element of a
 <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code>, passing an accumulating parameter from right to left, and
 returning a final value of this accumulator together with the new
 <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code>.  Performs replacement on invalid scalar values.</p></div></div><h2 id="g:14">Generation and unfolding</h2><div class="top"><p class="src"><a name="v:repeat" class="def">repeat</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Lazy.html#repeat" class="link">Source</a></p><div class="doc"><p><code><code><a href="Data-Text-Lazy.html#v:repeat">repeat</a></code> x</code> is an infinite <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code>, with <code>x</code> the value of every
 element.</p></div></div><div class="top"><p class="src"><a name="v:replicate" class="def">replicate</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Int.html#t:Int64">Int64</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Lazy.html#replicate" class="link">Source</a></p><div class="doc"><p><em>O(n*m)</em> <code><a href="Data-Text-Lazy.html#v:replicate">replicate</a></code> <code>n</code> <code>t</code> is a <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code> consisting of the input
 <code>t</code> repeated <code>n</code> times.</p></div></div><div class="top"><p class="src"><a name="v:cycle" class="def">cycle</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Lazy.html#cycle" class="link">Source</a></p><div class="doc"><p><code><a href="Data-Text-Lazy.html#v:cycle">cycle</a></code> ties a finite, non-empty <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code> into a circular one, or
 equivalently, the infinite repetition of the original <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code>.</p></div></div><div class="top"><p class="src"><a name="v:iterate" class="def">iterate</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a>) -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Lazy.html#iterate" class="link">Source</a></p><div class="doc"><p><code><code><a href="Data-Text-Lazy.html#v:iterate">iterate</a></code> f x</code> returns an infinite <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code> of repeated applications
 of <code>f</code> to <code>x</code>:</p><pre>iterate f x == [x, f x, f (f x), ...]</pre></div></div><div class="top"><p class="src"><a name="v:unfoldr" class="def">unfoldr</a> :: (a -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Maybe.html#t:Maybe">Maybe</a> (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a>, a)) -&gt; a -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Lazy.html#unfoldr" class="link">Source</a></p><div class="doc"><p><em>O(n)</em>, where <code>n</code> is the length of the result. The <code><a href="Data-Text-Lazy.html#v:unfoldr">unfoldr</a></code>
 function is analogous to the List <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/GHC-OldList.html#v:unfoldr">unfoldr</a></code>. <code><a href="Data-Text-Lazy.html#v:unfoldr">unfoldr</a></code> builds a
 <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code> from a seed value. The function takes the element and
 returns <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Maybe.html#v:Nothing">Nothing</a></code> if it is done producing the <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code>, otherwise
 <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Maybe.html#v:Just">Just</a></code> <code>(a,b)</code>.  In this case, <code>a</code> is the next <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a></code> in the
 string, and <code>b</code> is the seed value for further production.  Performs
 replacement on invalid scalar values.</p></div></div><div class="top"><p class="src"><a name="v:unfoldrN" class="def">unfoldrN</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Int.html#t:Int64">Int64</a> -&gt; (a -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Maybe.html#t:Maybe">Maybe</a> (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a>, a)) -&gt; a -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Lazy.html#unfoldrN" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Like <code><a href="Data-Text-Lazy.html#v:unfoldr">unfoldr</a></code>, <code><a href="Data-Text-Lazy.html#v:unfoldrN">unfoldrN</a></code> builds a <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code> from a seed
 value. However, the length of the result should be limited by the
 first argument to <code><a href="Data-Text-Lazy.html#v:unfoldrN">unfoldrN</a></code>. This function is more efficient than
 <code><a href="Data-Text-Lazy.html#v:unfoldr">unfoldr</a></code> when the maximum length of the result is known and
 correct, otherwise its performance is similar to <code><a href="Data-Text-Lazy.html#v:unfoldr">unfoldr</a></code>.
 Performs replacement on invalid scalar values.</p></div></div><h1 id="g:15">Substrings</h1><h2 id="g:16">Breaking strings</h2><div class="top"><p class="src"><a name="v:take" class="def">take</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Int.html#t:Int64">Int64</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Lazy.html#take" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> <code><a href="Data-Text-Lazy.html#v:take">take</a></code> <code>n</code>, applied to a <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code>, returns the prefix of the
 <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code> of length <code>n</code>, or the <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code> itself if <code>n</code> is greater than
 the length of the Text. Subject to fusion.</p></div></div><div class="top"><p class="src"><a name="v:takeEnd" class="def">takeEnd</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Int.html#t:Int64">Int64</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Lazy.html#takeEnd" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> <code><a href="Data-Text-Lazy.html#v:takeEnd">takeEnd</a></code> <code>n</code> <code>t</code> returns the suffix remaining after
 taking <code>n</code> characters from the end of <code>t</code>.</p><p>Examples:</p><pre>takeEnd 3 &quot;foobar&quot; == &quot;bar&quot;</pre></div></div><div class="top"><p class="src"><a name="v:drop" class="def">drop</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Int.html#t:Int64">Int64</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Lazy.html#drop" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> <code><a href="Data-Text-Lazy.html#v:drop">drop</a></code> <code>n</code>, applied to a <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code>, returns the suffix of the
 <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code> after the first <code>n</code> characters, or the empty <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code> if <code>n</code>
 is greater than the length of the <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code>. Subject to fusion.</p></div></div><div class="top"><p class="src"><a name="v:dropEnd" class="def">dropEnd</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Int.html#t:Int64">Int64</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Lazy.html#dropEnd" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> <code><a href="Data-Text-Lazy.html#v:dropEnd">dropEnd</a></code> <code>n</code> <code>t</code> returns the prefix remaining after
 dropping <code>n</code> characters from the end of <code>t</code>.</p><p>Examples:</p><pre>dropEnd 3 &quot;foobar&quot; == &quot;foo&quot;</pre></div></div><div class="top"><p class="src"><a name="v:takeWhile" class="def">takeWhile</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Bool.html#t:Bool">Bool</a>) -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Lazy.html#takeWhile" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> <code><a href="Data-Text-Lazy.html#v:takeWhile">takeWhile</a></code>, applied to a predicate <code>p</code> and a <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code>,
 returns the longest prefix (possibly empty) of elements that
 satisfy <code>p</code>.  Subject to fusion.</p></div></div><div class="top"><p class="src"><a name="v:takeWhileEnd" class="def">takeWhileEnd</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Bool.html#t:Bool">Bool</a>) -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Lazy.html#takeWhileEnd" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> <code><a href="Data-Text-Lazy.html#v:takeWhileEnd">takeWhileEnd</a></code>, applied to a predicate <code>p</code> and a <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code>,
 returns the longest suffix (possibly empty) of elements that
 satisfy <code>p</code>.
 Examples:</p><pre>takeWhileEnd (=='o') &quot;foo&quot; == &quot;oo&quot;</pre></div></div><div class="top"><p class="src"><a name="v:dropWhile" class="def">dropWhile</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Bool.html#t:Bool">Bool</a>) -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Lazy.html#dropWhile" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> <code><a href="Data-Text-Lazy.html#v:dropWhile">dropWhile</a></code> <code>p</code> <code>t</code> returns the suffix remaining after
 <code><a href="Data-Text-Lazy.html#v:takeWhile">takeWhile</a></code> <code>p</code> <code>t</code>.  Subject to fusion.</p></div></div><div class="top"><p class="src"><a name="v:dropWhileEnd" class="def">dropWhileEnd</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Bool.html#t:Bool">Bool</a>) -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Lazy.html#dropWhileEnd" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> <code><a href="Data-Text-Lazy.html#v:dropWhileEnd">dropWhileEnd</a></code> <code>p</code> <code>t</code> returns the prefix remaining after
 dropping characters that satisfy the predicate <code>p</code> from the end of
 <code>t</code>.</p><p>Examples:</p><pre>dropWhileEnd (=='.') &quot;foo...&quot; == &quot;foo&quot;</pre></div></div><div class="top"><p class="src"><a name="v:dropAround" class="def">dropAround</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Bool.html#t:Bool">Bool</a>) -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Lazy.html#dropAround" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> <code><a href="Data-Text-Lazy.html#v:dropAround">dropAround</a></code> <code>p</code> <code>t</code> returns the substring remaining after
 dropping characters that satisfy the predicate <code>p</code> from both the
 beginning and end of <code>t</code>.  Subject to fusion.</p></div></div><div class="top"><p class="src"><a name="v:strip" class="def">strip</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Lazy.html#strip" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Remove leading and trailing white space from a string.
 Equivalent to:</p><pre>dropAround isSpace</pre></div></div><div class="top"><p class="src"><a name="v:stripStart" class="def">stripStart</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Lazy.html#stripStart" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Remove leading white space from a string.  Equivalent to:</p><pre>dropWhile isSpace</pre></div></div><div class="top"><p class="src"><a name="v:stripEnd" class="def">stripEnd</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Lazy.html#stripEnd" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Remove trailing white space from a string.  Equivalent to:</p><pre>dropWhileEnd isSpace</pre></div></div><div class="top"><p class="src"><a name="v:splitAt" class="def">splitAt</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Int.html#t:Int64">Int64</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; (<a href="Data-Text-Lazy.html#t:Text">Text</a>, <a href="Data-Text-Lazy.html#t:Text">Text</a>) <a href="src/Data-Text-Lazy.html#splitAt" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> <code><a href="Data-Text-Lazy.html#v:splitAt">splitAt</a></code> <code>n t</code> returns a pair whose first element is a
 prefix of <code>t</code> of length <code>n</code>, and whose second is the remainder of
 the string. It is equivalent to <code>(<code><a href="Data-Text-Lazy.html#v:take">take</a></code> n t, <code><a href="Data-Text-Lazy.html#v:drop">drop</a></code> n t)</code>.</p></div></div><div class="top"><p class="src"><a name="v:span" class="def">span</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Bool.html#t:Bool">Bool</a>) -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; (<a href="Data-Text-Lazy.html#t:Text">Text</a>, <a href="Data-Text-Lazy.html#t:Text">Text</a>) <a href="src/Data-Text-Lazy.html#span" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> <code><a href="Data-Text-Lazy.html#v:span">span</a></code>, applied to a predicate <code>p</code> and text <code>t</code>, returns
 a pair whose first element is the longest prefix (possibly empty)
 of <code>t</code> of elements that satisfy <code>p</code>, and whose second is the
 remainder of the list.</p></div></div><div class="top"><p class="src"><a name="v:breakOn" class="def">breakOn</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; (<a href="Data-Text-Lazy.html#t:Text">Text</a>, <a href="Data-Text-Lazy.html#t:Text">Text</a>) <a href="src/Data-Text-Lazy.html#breakOn" class="link">Source</a></p><div class="doc"><p><em>O(n+m)</em> Find the first instance of <code>needle</code> (which must be
 non-<code><a href="Data-Text-Lazy.html#v:null">null</a></code>) in <code>haystack</code>.  The first element of the returned tuple
 is the prefix of <code>haystack</code> before <code>needle</code> is matched.  The second
 is the remainder of <code>haystack</code>, starting with the match.</p><p>Examples:</p><pre>breakOn &quot;::&quot; &quot;a::b::c&quot; ==&gt; (&quot;a&quot;, &quot;::b::c&quot;)
breakOn &quot;/&quot; &quot;foobar&quot;   ==&gt; (&quot;foobar&quot;, &quot;&quot;)</pre><p>Laws:</p><pre>append prefix match == haystack
  where (prefix, match) = breakOn needle haystack</pre><p>If you need to break a string by a substring repeatedly (e.g. you
 want to break on every instance of a substring), use <code><a href="Data-Text-Lazy.html#v:breakOnAll">breakOnAll</a></code>
 instead, as it has lower startup overhead.</p><p>This function is strict in its first argument, and lazy in its
 second.</p><p>In (unlikely) bad cases, this function's time complexity degrades
 towards <em>O(n*m)</em>.</p></div></div><div class="top"><p class="src"><a name="v:breakOnEnd" class="def">breakOnEnd</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; (<a href="Data-Text-Lazy.html#t:Text">Text</a>, <a href="Data-Text-Lazy.html#t:Text">Text</a>) <a href="src/Data-Text-Lazy.html#breakOnEnd" class="link">Source</a></p><div class="doc"><p><em>O(n+m)</em> Similar to <code><a href="Data-Text-Lazy.html#v:breakOn">breakOn</a></code>, but searches from the end of the string.</p><p>The first element of the returned tuple is the prefix of <code>haystack</code>
 up to and including the last match of <code>needle</code>.  The second is the
 remainder of <code>haystack</code>, following the match.</p><pre>breakOnEnd &quot;::&quot; &quot;a::b::c&quot; ==&gt; (&quot;a::b::&quot;, &quot;c&quot;)</pre></div></div><div class="top"><p class="src"><a name="v:break" class="def">break</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Bool.html#t:Bool">Bool</a>) -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; (<a href="Data-Text-Lazy.html#t:Text">Text</a>, <a href="Data-Text-Lazy.html#t:Text">Text</a>) <a href="src/Data-Text-Lazy.html#break" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> <code><a href="Data-Text-Lazy.html#v:break">break</a></code> is like <code><a href="Data-Text-Lazy.html#v:span">span</a></code>, but the prefix returned is over
 elements that fail the predicate <code>p</code>.</p></div></div><div class="top"><p class="src"><a name="v:group" class="def">group</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; [<a href="Data-Text-Lazy.html#t:Text">Text</a>] <a href="src/Data-Text-Lazy.html#group" class="link">Source</a></p><div class="doc"><p>The <code><a href="Data-Text-Lazy.html#v:group">group</a></code> function takes a <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code> and returns a list of <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code>s
 such that the concatenation of the result is equal to the argument.
 Moreover, each sublist in the result contains only equal elements.
 For example,</p><pre>group &quot;Mississippi&quot; = [&quot;M&quot;,&quot;i&quot;,&quot;ss&quot;,&quot;i&quot;,&quot;ss&quot;,&quot;i&quot;,&quot;pp&quot;,&quot;i&quot;]</pre><p>It is a special case of <code><a href="Data-Text-Lazy.html#v:groupBy">groupBy</a></code>, which allows the programmer to
 supply their own equality test.</p></div></div><div class="top"><p class="src"><a name="v:groupBy" class="def">groupBy</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Bool.html#t:Bool">Bool</a>) -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; [<a href="Data-Text-Lazy.html#t:Text">Text</a>] <a href="src/Data-Text-Lazy.html#groupBy" class="link">Source</a></p><div class="doc"><p>The <code><a href="Data-Text-Lazy.html#v:groupBy">groupBy</a></code> function is the non-overloaded version of <code><a href="Data-Text-Lazy.html#v:group">group</a></code>.</p></div></div><div class="top"><p class="src"><a name="v:inits" class="def">inits</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; [<a href="Data-Text-Lazy.html#t:Text">Text</a>] <a href="src/Data-Text-Lazy.html#inits" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Return all initial segments of the given <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code>,
 shortest first.</p></div></div><div class="top"><p class="src"><a name="v:tails" class="def">tails</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; [<a href="Data-Text-Lazy.html#t:Text">Text</a>] <a href="src/Data-Text-Lazy.html#tails" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Return all final segments of the given <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code>, longest
 first.</p></div></div><h2 id="g:17">Breaking into many substrings</h2><div class="doc"><p>Splitting functions in this library do not perform character-wise
 copies to create substrings; they just construct new <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code>s that
 are slices of the original.</p></div><div class="top"><p class="src"><a name="v:splitOn" class="def">splitOn</a> <a href="src/Data-Text-Lazy.html#splitOn" class="link">Source</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: <a href="Data-Text-Lazy.html#t:Text">Text</a></td><td class="doc"><p>String to split on. If this string is empty, an error
 will occur.</p></td></tr><tr><td class="src">-&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a></td><td class="doc"><p>Input text.</p></td></tr><tr><td class="src">-&gt; [<a href="Data-Text-Lazy.html#t:Text">Text</a>]</td><td class="doc empty">&nbsp;</td></tr></table></div><div class="doc"><p><em>O(m+n)</em> Break a <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code> into pieces separated by the first <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code>
 argument (which cannot be an empty string), consuming the
 delimiter. An empty delimiter is invalid, and will cause an error
 to be raised.</p><p>Examples:</p><pre>splitOn &quot;\r\n&quot; &quot;a\r\nb\r\nd\r\ne&quot; == [&quot;a&quot;,&quot;b&quot;,&quot;d&quot;,&quot;e&quot;]
splitOn &quot;aaa&quot;  &quot;aaaXaaaXaaaXaaa&quot;  == [&quot;&quot;,&quot;X&quot;,&quot;X&quot;,&quot;X&quot;,&quot;&quot;]
splitOn &quot;x&quot;    &quot;x&quot;                == [&quot;&quot;,&quot;&quot;]</pre><p>and</p><pre>intercalate s . splitOn s         == id
splitOn (singleton c)             == split (==c)</pre><p>(Note: the string <code>s</code> to split on above cannot be empty.)</p><p>This function is strict in its first argument, and lazy in its
 second.</p><p>In (unlikely) bad cases, this function's time complexity degrades
 towards <em>O(n*m)</em>.</p></div></div><div class="top"><p class="src"><a name="v:split" class="def">split</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Bool.html#t:Bool">Bool</a>) -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; [<a href="Data-Text-Lazy.html#t:Text">Text</a>] <a href="src/Data-Text-Lazy.html#split" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Splits a <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code> into components delimited by separators,
 where the predicate returns True for a separator element.  The
 resulting components do not contain the separators.  Two adjacent
 separators result in an empty component in the output.  eg.</p><pre>split (=='a') &quot;aabbaca&quot; == [&quot;&quot;,&quot;&quot;,&quot;bb&quot;,&quot;c&quot;,&quot;&quot;]
split (=='a') []        == [&quot;&quot;]</pre></div></div><div class="top"><p class="src"><a name="v:chunksOf" class="def">chunksOf</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Int.html#t:Int64">Int64</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; [<a href="Data-Text-Lazy.html#t:Text">Text</a>] <a href="src/Data-Text-Lazy.html#chunksOf" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Splits a <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code> into components of length <code>k</code>.  The last
 element may be shorter than the other chunks, depending on the
 length of the input. Examples:</p><pre>chunksOf 3 &quot;foobarbaz&quot;   == [&quot;foo&quot;,&quot;bar&quot;,&quot;baz&quot;]
chunksOf 4 &quot;haskell.org&quot; == [&quot;hask&quot;,&quot;ell.&quot;,&quot;org&quot;]</pre></div></div><h2 id="g:18">Breaking into lines and words</h2><div class="top"><p class="src"><a name="v:lines" class="def">lines</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; [<a href="Data-Text-Lazy.html#t:Text">Text</a>] <a href="src/Data-Text-Lazy.html#lines" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Breaks a <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code> up into a list of <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code>s at
 newline <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a></code>s. The resulting strings do not contain newlines.</p></div></div><div class="top"><p class="src"><a name="v:words" class="def">words</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; [<a href="Data-Text-Lazy.html#t:Text">Text</a>] <a href="src/Data-Text-Lazy.html#words" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Breaks a <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code> up into a list of words, delimited by <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a></code>s
 representing white space.</p></div></div><div class="top"><p class="src"><a name="v:unlines" class="def">unlines</a> :: [<a href="Data-Text-Lazy.html#t:Text">Text</a>] -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Lazy.html#unlines" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Joins lines, after appending a terminating newline to
 each.</p></div></div><div class="top"><p class="src"><a name="v:unwords" class="def">unwords</a> :: [<a href="Data-Text-Lazy.html#t:Text">Text</a>] -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Lazy.html#unwords" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Joins words using single space characters.</p></div></div><h1 id="g:19">Predicates</h1><div class="top"><p class="src"><a name="v:isPrefixOf" class="def">isPrefixOf</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Bool.html#t:Bool">Bool</a> <a href="src/Data-Text-Lazy.html#isPrefixOf" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> The <code><a href="Data-Text-Lazy.html#v:isPrefixOf">isPrefixOf</a></code> function takes two <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code>s and returns
 <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Bool.html#v:True">True</a></code> iff the first is a prefix of the second.  Subject to fusion.</p></div></div><div class="top"><p class="src"><a name="v:isSuffixOf" class="def">isSuffixOf</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Bool.html#t:Bool">Bool</a> <a href="src/Data-Text-Lazy.html#isSuffixOf" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> The <code><a href="Data-Text-Lazy.html#v:isSuffixOf">isSuffixOf</a></code> function takes two <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code>s and returns
 <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Bool.html#v:True">True</a></code> iff the first is a suffix of the second.</p></div></div><div class="top"><p class="src"><a name="v:isInfixOf" class="def">isInfixOf</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Bool.html#t:Bool">Bool</a> <a href="src/Data-Text-Lazy.html#isInfixOf" class="link">Source</a></p><div class="doc"><p><em>O(n+m)</em> The <code><a href="Data-Text-Lazy.html#v:isInfixOf">isInfixOf</a></code> function takes two <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code>s and returns
 <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Bool.html#v:True">True</a></code> iff the first is contained, wholly and intact, anywhere
 within the second.</p><p>This function is strict in its first argument, and lazy in its
 second.</p><p>In (unlikely) bad cases, this function's time complexity degrades
 towards <em>O(n*m)</em>.</p></div></div><h2 id="g:20">View patterns</h2><div class="top"><p class="src"><a name="v:stripPrefix" class="def">stripPrefix</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Lazy.html#stripPrefix" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Return the suffix of the second string if its prefix
 matches the entire first string.</p><p>Examples:</p><pre>stripPrefix &quot;foo&quot; &quot;foobar&quot; == Just &quot;bar&quot;
stripPrefix &quot;&quot;    &quot;baz&quot;    == Just &quot;baz&quot;
stripPrefix &quot;foo&quot; &quot;quux&quot;   == Nothing</pre><p>This is particularly useful with the <code>ViewPatterns</code> extension to
 GHC, as follows:</p><pre>{-# LANGUAGE ViewPatterns #-}
import Data.Text.Lazy as T

fnordLength :: Text -&gt; Int
fnordLength (stripPrefix &quot;fnord&quot; -&gt; Just suf) = T.length suf
fnordLength _                                 = -1</pre></div></div><div class="top"><p class="src"><a name="v:stripSuffix" class="def">stripSuffix</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Lazy.html#stripSuffix" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Return the prefix of the second string if its suffix
 matches the entire first string.</p><p>Examples:</p><pre>stripSuffix &quot;bar&quot; &quot;foobar&quot; == Just &quot;foo&quot;
stripSuffix &quot;&quot;    &quot;baz&quot;    == Just &quot;baz&quot;
stripSuffix &quot;foo&quot; &quot;quux&quot;   == Nothing</pre><p>This is particularly useful with the <code>ViewPatterns</code> extension to
 GHC, as follows:</p><pre>{-# LANGUAGE ViewPatterns #-}
import Data.Text.Lazy as T

quuxLength :: Text -&gt; Int
quuxLength (stripSuffix &quot;quux&quot; -&gt; Just pre) = T.length pre
quuxLength _                                = -1</pre></div></div><div class="top"><p class="src"><a name="v:commonPrefixes" class="def">commonPrefixes</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Maybe.html#t:Maybe">Maybe</a> (<a href="Data-Text-Lazy.html#t:Text">Text</a>, <a href="Data-Text-Lazy.html#t:Text">Text</a>, <a href="Data-Text-Lazy.html#t:Text">Text</a>) <a href="src/Data-Text-Lazy.html#commonPrefixes" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Find the longest non-empty common prefix of two strings
 and return it, along with the suffixes of each string at which they
 no longer match.</p><p>If the strings do not have a common prefix or either one is empty,
 this function returns <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Maybe.html#v:Nothing">Nothing</a></code>.</p><p>Examples:</p><pre>commonPrefixes &quot;foobar&quot; &quot;fooquux&quot; == Just (&quot;foo&quot;,&quot;bar&quot;,&quot;quux&quot;)
commonPrefixes &quot;veeble&quot; &quot;fetzer&quot;  == Nothing
commonPrefixes &quot;&quot; &quot;baz&quot;           == Nothing</pre></div></div><h1 id="g:21">Searching</h1><div class="top"><p class="src"><a name="v:filter" class="def">filter</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Bool.html#t:Bool">Bool</a>) -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Lazy.html#filter" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> <code><a href="Data-Text-Lazy.html#v:filter">filter</a></code>, applied to a predicate and a <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code>,
 returns a <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code> containing those characters that satisfy the
 predicate.</p></div></div><div class="top"><p class="src"><a name="v:find" class="def">find</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Bool.html#t:Bool">Bool</a>) -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> <a href="src/Data-Text-Lazy.html#find" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> The <code><a href="Data-Text-Lazy.html#v:find">find</a></code> function takes a predicate and a <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code>, and
 returns the first element in matching the predicate, or <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Maybe.html#v:Nothing">Nothing</a></code>
 if there is no such element.</p></div></div><div class="top"><p class="src"><a name="v:breakOnAll" class="def">breakOnAll</a> <a href="src/Data-Text-Lazy.html#breakOnAll" class="link">Source</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: <a href="Data-Text-Lazy.html#t:Text">Text</a></td><td class="doc"><p><code>needle</code> to search for</p></td></tr><tr><td class="src">-&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a></td><td class="doc"><p><code>haystack</code> in which to search</p></td></tr><tr><td class="src">-&gt; [(<a href="Data-Text-Lazy.html#t:Text">Text</a>, <a href="Data-Text-Lazy.html#t:Text">Text</a>)]</td><td class="doc empty">&nbsp;</td></tr></table></div><div class="doc"><p><em>O(n+m)</em> Find all non-overlapping instances of <code>needle</code> in
 <code>haystack</code>.  Each element of the returned list consists of a pair:</p><ul><li>The entire string prior to the <em>k</em>th match (i.e. the prefix)</li><li>The <em>k</em>th match, followed by the remainder of the string</li></ul><p>Examples:</p><pre>breakOnAll &quot;::&quot; &quot;&quot;
==&gt; []
breakOnAll &quot;/&quot; &quot;a/b/c/&quot;
==&gt; [(&quot;a&quot;, &quot;/b/c/&quot;), (&quot;a/b&quot;, &quot;/c/&quot;), (&quot;a/b/c&quot;, &quot;/&quot;)]</pre><p>This function is strict in its first argument, and lazy in its
 second.</p><p>In (unlikely) bad cases, this function's time complexity degrades
 towards <em>O(n*m)</em>.</p><p>The <code>needle</code> parameter may not be empty.</p></div></div><div class="top"><p class="src"><a name="v:partition" class="def">partition</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Bool.html#t:Bool">Bool</a>) -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; (<a href="Data-Text-Lazy.html#t:Text">Text</a>, <a href="Data-Text-Lazy.html#t:Text">Text</a>) <a href="src/Data-Text-Lazy.html#partition" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> The <code><a href="Data-Text-Lazy.html#v:partition">partition</a></code> function takes a predicate and a <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code>,
 and returns the pair of <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code>s with elements which do and do not
 satisfy the predicate, respectively; i.e.</p><pre>partition p t == (filter p t, filter (not . p) t)</pre></div></div><h1 id="g:22">Indexing</h1><div class="top"><p class="src"><a name="v:index" class="def">index</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Int.html#t:Int64">Int64</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> <a href="src/Data-Text-Lazy.html#index" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code> index (subscript) operator, starting from 0.</p></div></div><div class="top"><p class="src"><a name="v:count" class="def">count</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Int.html#t:Int64">Int64</a> <a href="src/Data-Text-Lazy.html#count" class="link">Source</a></p><div class="doc"><p><em>O(n+m)</em> The <code><a href="Data-Text-Lazy.html#v:count">count</a></code> function returns the number of times the
 query string appears in the given <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code>. An empty query string is
 invalid, and will cause an error to be raised.</p><p>In (unlikely) bad cases, this function's time complexity degrades
 towards <em>O(n*m)</em>.</p></div></div><h1 id="g:23">Zipping and unzipping</h1><div class="top"><p class="src"><a name="v:zip" class="def">zip</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; [(<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a>, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a>)] <a href="src/Data-Text-Lazy.html#zip" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> <code><a href="Data-Text-Lazy.html#v:zip">zip</a></code> takes two <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code>s and returns a list of
 corresponding pairs of bytes. If one input <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code> is short,
 excess elements of the longer <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code> are discarded. This is
 equivalent to a pair of <code><a href="Data-Text-Lazy.html#v:unpack">unpack</a></code> operations.</p></div></div><div class="top"><p class="src"><a name="v:zipWith" class="def">zipWith</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a>) -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> -&gt; <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Lazy.html#zipWith" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> <code><a href="Data-Text-Lazy.html#v:zipWith">zipWith</a></code> generalises <code><a href="Data-Text-Lazy.html#v:zip">zip</a></code> by zipping with the function
 given as the first argument, instead of a tupling function.
 Performs replacement on invalid scalar values.</p></div></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.16.1</p></div></body></html>