This file is indexed.

/usr/share/doc/libghc-text-doc/html/Data-Text.html is in libghc-text-doc 0.11.1.13-1build1.

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
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
<!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</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.html");};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="src/Data-Text.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-0.11.1.13: An efficient packed Unicode text type.</p></div><div id="content"><div id="module-header"><table class="info"><tr><th>Portability</th><td>GHC</td></tr><tr><th>Stability</th><td>experimental</td></tr><tr><th>Maintainer</th><td>bos@serpentine.com, rtomharper@googlemail.com,
               duncan@haskell.org</td></tr><tr><th>Safe Haskell</th><td>Safe-Infered</td></tr></table><p class="caption">Data.Text</p></div><div id="table-of-contents"><p class="caption">Contents</p><ul><li><a href="#g:1">Strict vs lazy types
</a></li><li><a href="#g:2">Acceptable data
</a></li><li><a href="#g:3">Fusion
</a></li><li><a href="#g:4">Types
</a></li><li><a href="#g:5">Creation and elimination
</a></li><li><a href="#g:6">Basic interface
</a></li><li><a href="#g:7">Transformations
</a><ul><li><a href="#g:8">Case conversion
</a></li><li><a href="#g:9">Justification
</a></li></ul></li><li><a href="#g:10">Folds
</a><ul><li><a href="#g:11">Special folds
</a></li></ul></li><li><a href="#g:12">Construction
</a><ul><li><a href="#g:13">Scans
</a></li><li><a href="#g:14">Accumulating maps
</a></li><li><a href="#g:15">Generation and unfolding
</a></li></ul></li><li><a href="#g:16">Substrings
</a><ul><li><a href="#g:17">Breaking strings
</a></li><li><a href="#g:18">Breaking into many substrings
</a></li><li><a href="#g:19">Breaking into lines and words
</a></li></ul></li><li><a href="#g:20">Predicates
</a><ul><li><a href="#g:21">View patterns
</a></li></ul></li><li><a href="#g:22">Searching
</a></li><li><a href="#g:23">Indexing
</a></li><li><a href="#g:24">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.
 Suitable for performance critical use, both in terms of large data
 quantities and high speed.
</p><p><em>Note</em>: Read below the synopsis for important notes on the use of
 this module.
</p><p>This module is intended to be imported <code>qualified</code>, to avoid name
 clashes with <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Prelude.html">Prelude</a> functions, e.g.
</p><pre> import qualified Data.Text as T
</pre><p>To use an extended and very rich family of functions for working
 with Unicode text (including normalization, regular expressions,
 non-standard encodings, text breaking, and locales), see the
 <code>text-icu</code> package: <a href="http://hackage.haskell.org/package/text-icu">http://hackage.haskell.org/package/text-icu</a>
</p></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="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a> -&gt; <a href="Data-Text.html#t:Text">Text</a></li><li class="src short"><a href="#v:unpack">unpack</a> :: <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a></li><li class="src short"><a href="#v:singleton">singleton</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="Data-Text.html#t:Text">Text</a></li><li class="src short"><a href="#v:empty">empty</a> :: <a href="Data-Text.html#t:Text">Text</a></li><li class="src short"><a href="#v:cons">cons</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a></li><li class="src short"><a href="#v:snoc">snoc</a> :: <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="Data-Text.html#t:Text">Text</a></li><li class="src short"><a href="#v:append">append</a> :: <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a></li><li class="src short"><a href="#v:uncons">uncons</a> :: <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Maybe.html#t:Maybe">Maybe</a> (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a>, <a href="Data-Text.html#t:Text">Text</a>)</li><li class="src short"><a href="#v:head">head</a> :: <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a></li><li class="src short"><a href="#v:last">last</a> :: <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a></li><li class="src short"><a href="#v:tail">tail</a> :: <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a></li><li class="src short"><a href="#v:init">init</a> :: <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a></li><li class="src short"><a href="#v:null">null</a> :: <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><a href="#v:length">length</a> :: <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a></li><li class="src short"><a href="#v:compareLength">compareLength</a> :: <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Ord.html#t:Ordering">Ordering</a></li><li class="src short"><a href="#v:map">map</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a>) -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a></li><li class="src short"><a href="#v:intercalate">intercalate</a> :: <a href="Data-Text.html#t:Text">Text</a> -&gt; [<a href="Data-Text.html#t:Text">Text</a>] -&gt; <a href="Data-Text.html#t:Text">Text</a></li><li class="src short"><a href="#v:intersperse">intersperse</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a></li><li class="src short"><a href="#v:transpose">transpose</a> :: [<a href="Data-Text.html#t:Text">Text</a>] -&gt; [<a href="Data-Text.html#t:Text">Text</a>]</li><li class="src short"><a href="#v:reverse">reverse</a> :: <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a></li><li class="src short"><a href="#v:replace">replace</a> :: <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a></li><li class="src short"><a href="#v:toCaseFold">toCaseFold</a> :: <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a></li><li class="src short"><a href="#v:toLower">toLower</a> :: <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a></li><li class="src short"><a href="#v:toUpper">toUpper</a> :: <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a></li><li class="src short"><a href="#v:justifyLeft">justifyLeft</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a></li><li class="src short"><a href="#v:justifyRight">justifyRight</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a></li><li class="src short"><a href="#v:center">center</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a></li><li class="src short"><a href="#v:foldl">foldl</a> ::  (a -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a> -&gt; a) -&gt; a -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; a</li><li class="src short"><a href="#v:foldl-39-">foldl'</a> ::  (a -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a> -&gt; a) -&gt; a -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; a</li><li class="src short"><a href="#v:foldl1">foldl1</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a>) -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a></li><li class="src short"><a href="#v:foldl1-39-">foldl1'</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a>) -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a></li><li class="src short"><a href="#v:foldr">foldr</a> ::  (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a> -&gt; a -&gt; a) -&gt; a -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; a</li><li class="src short"><a href="#v:foldr1">foldr1</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a>) -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a></li><li class="src short"><a href="#v:concat">concat</a> :: [<a href="Data-Text.html#t:Text">Text</a>] -&gt; <a href="Data-Text.html#t:Text">Text</a></li><li class="src short"><a href="#v:concatMap">concatMap</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="Data-Text.html#t:Text">Text</a>) -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a></li><li class="src short"><a href="#v:any">any</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a>) -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><a href="#v:all">all</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a>) -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><a href="#v:maximum">maximum</a> :: <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a></li><li class="src short"><a href="#v:minimum">minimum</a> :: <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a></li><li class="src short"><a href="#v:scanl">scanl</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a>) -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a></li><li class="src short"><a href="#v:scanl1">scanl1</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a>) -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a></li><li class="src short"><a href="#v:scanr">scanr</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a>) -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a></li><li class="src short"><a href="#v:scanr1">scanr1</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a>) -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a></li><li class="src short"><a href="#v:mapAccumL">mapAccumL</a> ::  (a -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a> -&gt; (a, <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a>)) -&gt; a -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; (a, <a href="Data-Text.html#t:Text">Text</a>)</li><li class="src short"><a href="#v:mapAccumR">mapAccumR</a> ::  (a -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a> -&gt; (a, <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a>)) -&gt; a -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; (a, <a href="Data-Text.html#t:Text">Text</a>)</li><li class="src short"><a href="#v:replicate">replicate</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a></li><li class="src short"><a href="#v:unfoldr">unfoldr</a> ::  (a -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Maybe.html#t:Maybe">Maybe</a> (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a>, a)) -&gt; a -&gt; <a href="Data-Text.html#t:Text">Text</a></li><li class="src short"><a href="#v:unfoldrN">unfoldrN</a> ::  <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -&gt; (a -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Maybe.html#t:Maybe">Maybe</a> (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a>, a)) -&gt; a -&gt; <a href="Data-Text.html#t:Text">Text</a></li><li class="src short"><a href="#v:take">take</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a></li><li class="src short"><a href="#v:drop">drop</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a></li><li class="src short"><a href="#v:takeWhile">takeWhile</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a>) -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a></li><li class="src short"><a href="#v:dropWhile">dropWhile</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a>) -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a></li><li class="src short"><a href="#v:dropWhileEnd">dropWhileEnd</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a>) -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a></li><li class="src short"><a href="#v:dropAround">dropAround</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a>) -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a></li><li class="src short"><a href="#v:strip">strip</a> :: <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a></li><li class="src short"><a href="#v:stripStart">stripStart</a> :: <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a></li><li class="src short"><a href="#v:stripEnd">stripEnd</a> :: <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a></li><li class="src short"><a href="#v:splitAt">splitAt</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; (<a href="Data-Text.html#t:Text">Text</a>, <a href="Data-Text.html#t:Text">Text</a>)</li><li class="src short"><a href="#v:breakOn">breakOn</a> :: <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; (<a href="Data-Text.html#t:Text">Text</a>, <a href="Data-Text.html#t:Text">Text</a>)</li><li class="src short"><a href="#v:breakOnEnd">breakOnEnd</a> :: <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; (<a href="Data-Text.html#t:Text">Text</a>, <a href="Data-Text.html#t:Text">Text</a>)</li><li class="src short"><a href="#v:break">break</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a>) -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; (<a href="Data-Text.html#t:Text">Text</a>, <a href="Data-Text.html#t:Text">Text</a>)</li><li class="src short"><a href="#v:span">span</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a>) -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; (<a href="Data-Text.html#t:Text">Text</a>, <a href="Data-Text.html#t:Text">Text</a>)</li><li class="src short"><a href="#v:group">group</a> :: <a href="Data-Text.html#t:Text">Text</a> -&gt; [<a href="Data-Text.html#t:Text">Text</a>]</li><li class="src short"><a href="#v:groupBy">groupBy</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a>) -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; [<a href="Data-Text.html#t:Text">Text</a>]</li><li class="src short"><a href="#v:inits">inits</a> :: <a href="Data-Text.html#t:Text">Text</a> -&gt; [<a href="Data-Text.html#t:Text">Text</a>]</li><li class="src short"><a href="#v:tails">tails</a> :: <a href="Data-Text.html#t:Text">Text</a> -&gt; [<a href="Data-Text.html#t:Text">Text</a>]</li><li class="src short"><a href="#v:splitOn">splitOn</a> :: <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; [<a href="Data-Text.html#t:Text">Text</a>]</li><li class="src short"><a href="#v:split">split</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a>) -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; [<a href="Data-Text.html#t:Text">Text</a>]</li><li class="src short"><a href="#v:chunksOf">chunksOf</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; [<a href="Data-Text.html#t:Text">Text</a>]</li><li class="src short"><a href="#v:lines">lines</a> :: <a href="Data-Text.html#t:Text">Text</a> -&gt; [<a href="Data-Text.html#t:Text">Text</a>]</li><li class="src short"><a href="#v:words">words</a> :: <a href="Data-Text.html#t:Text">Text</a> -&gt; [<a href="Data-Text.html#t:Text">Text</a>]</li><li class="src short"><a href="#v:unlines">unlines</a> :: [<a href="Data-Text.html#t:Text">Text</a>] -&gt; <a href="Data-Text.html#t:Text">Text</a></li><li class="src short"><a href="#v:unwords">unwords</a> :: [<a href="Data-Text.html#t:Text">Text</a>] -&gt; <a href="Data-Text.html#t:Text">Text</a></li><li class="src short"><a href="#v:isPrefixOf">isPrefixOf</a> :: <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><a href="#v:isSuffixOf">isSuffixOf</a> :: <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><a href="#v:isInfixOf">isInfixOf</a> :: <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><a href="#v:stripPrefix">stripPrefix</a> :: <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="Data-Text.html#t:Text">Text</a></li><li class="src short"><a href="#v:stripSuffix">stripSuffix</a> :: <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="Data-Text.html#t:Text">Text</a></li><li class="src short"><a href="#v:commonPrefixes">commonPrefixes</a> :: <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Maybe.html#t:Maybe">Maybe</a> (<a href="Data-Text.html#t:Text">Text</a>, <a href="Data-Text.html#t:Text">Text</a>, <a href="Data-Text.html#t:Text">Text</a>)</li><li class="src short"><a href="#v:filter">filter</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a>) -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a></li><li class="src short"><a href="#v:breakOnAll">breakOnAll</a> :: <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; [(<a href="Data-Text.html#t:Text">Text</a>, <a href="Data-Text.html#t:Text">Text</a>)]</li><li class="src short"><a href="#v:find">find</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a>) -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a></li><li class="src short"><a href="#v:partition">partition</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a>) -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; (<a href="Data-Text.html#t:Text">Text</a>, <a href="Data-Text.html#t:Text">Text</a>)</li><li class="src short"><a href="#v:index">index</a> :: <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a></li><li class="src short"><a href="#v:findIndex">findIndex</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a>) -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a></li><li class="src short"><a href="#v:count">count</a> :: <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a></li><li class="src short"><a href="#v:zip">zip</a> :: <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; [(<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a>, <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a>)]</li><li class="src short"><a href="#v:zipWith">zipWith</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a>) -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a></li></ul></div><div id="interface"><h1 id="g:1">Strict vs lazy types
</h1><div class="doc"><p>This package provides both strict and lazy <code><a href="Data-Text.html#t:Text">Text</a></code> types.  The
 strict type is provided by the <code><a href="Data.html#t:Text">Text</a></code> package, while the lazy
 type is provided by the <code><a href="Data-Text.html#t:Lazy">Lazy</a></code> package.  Internally, the
 lazy <code>Text</code> type consists of a list of strict chunks.
</p><p>The strict <code><a href="Data-Text.html#t:Text">Text</a></code> type requires that an entire string fit into
 memory at once.  The lazy <code>Text</code> type is capable of streaming
 strings that are larger than memory using a small memory footprint.
 In many cases, the overhead of chunked streaming makes the lazy
 <code>Text</code> type slower than its strict counterpart, but this is not
 always the case.  Sometimes, the time complexity of a function in
 one module may be different from the other, due to their differing
 internal structures.
</p><p>Each module provides an almost identical API, with the main
 difference being that the strict module uses <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a></code> values for
 lengths and counts, while the lazy module uses <code>Int64</code> lengths.
</p></div><h1 id="g:2">Acceptable data
</h1><div class="doc"><p>A <code><a href="Data-Text.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.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="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.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="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.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.html#t:Text">Text</a></code> from one or
 more <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a></code> values. Those functions will substitute <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.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.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">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.html#t:Text">Text</a></code> value.
</p><p>As an example, consider the following pipeline:
</p><pre> import Data.Text as T
 import Data.Text.Encoding as E
 import Data.ByteString (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.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.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:4">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.html#Text" class="link">Source</a></p><div class="doc"><p>A space efficient, packed, unboxed Unicode text type.
</p></div><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"><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Eq.html#t:Eq">Eq</a> <a href="Data-Text.html#t:Text">Text</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Data.html#t:Data">Data</a> <a href="Data-Text.html#t:Text">Text</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Ord.html#t:Ord">Ord</a> <a href="Data-Text.html#t:Text">Text</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Text-Read.html#t:Read">Read</a> <a href="Data-Text.html#t:Text">Text</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Text-Show.html#t:Show">Show</a> <a href="Data-Text.html#t:Text">Text</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Typeable-Internal.html#t:Typeable">Typeable</a> <a href="Data-Text.html#t:Text">Text</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:IsString">IsString</a> <a href="Data-Text.html#t:Text">Text</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Monoid.html#t:Monoid">Monoid</a> <a href="Data-Text.html#t:Text">Text</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="/usr/share/doc/ghc-doc/html/libraries/deepseq-1.3.0.0/Control-DeepSeq.html#t:NFData">NFData</a> <a href="Data-Text.html#t:Text">Text</a></td><td class="doc empty">&nbsp;</td></tr></table></div></div></div><h1 id="g:5">Creation and elimination
</h1><div class="top"><p class="src"><a name="v:pack" class="def">pack</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a> -&gt; <a href="Data-Text.html#t:Text">Text</a><a href="src/Data-Text.html#pack" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Convert a <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a></code> into a <code><a href="Data-Text.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:unpack" class="def">unpack</a> :: <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a><a href="src/Data-Text.html#unpack" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Convert a Text into a String.  Subject to fusion.
</p></div></div><div class="top"><p class="src"><a name="v:singleton" class="def">singleton</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="Data-Text.html#t:Text">Text</a><a href="src/Data-Text.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.html#t:Text">Text</a><a href="src/Data-Text-Internal.html#empty" class="link">Source</a></p><div class="doc"><p><em>O(1)</em> The empty <code><a href="Data-Text.html#t:Text">Text</a></code>.
</p></div></div><h1 id="g:6">Basic interface
</h1><div class="top"><p class="src"><a name="v:cons" class="def">cons</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a><a href="src/Data-Text.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.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.  Performs replacement on
 invalid scalar values.
</p></div></div><div class="top"><p class="src"><a name="v:snoc" class="def">snoc</a> :: <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="Data-Text.html#t:Text">Text</a><a href="src/Data-Text.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.html#t:Text">Text</a></code>.  This copies the
 entire array in the process, unless fused.  Subject to fusion.
 Performs replacement on invalid scalar values.
</p></div></div><div class="top"><p class="src"><a name="v:append" class="def">append</a> :: <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a><a href="src/Data-Text.html#append" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Appends one <code><a href="Data-Text.html#t:Text">Text</a></code> to the other by copying both of them
 into a new <code><a href="Data-Text.html#t:Text">Text</a></code>.  Subject to fusion.
</p></div></div><div class="top"><p class="src"><a name="v:uncons" class="def">uncons</a> :: <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Maybe.html#t:Maybe">Maybe</a> (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a>, <a href="Data-Text.html#t:Text">Text</a>)<a href="src/Data-Text.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.html#t:Text">Text</a></code>, or
 <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.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.html#t:Text">Text</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a><a href="src/Data-Text.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.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.html#t:Text">Text</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a><a href="src/Data-Text.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.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.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a><a href="src/Data-Text.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.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.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a><a href="src/Data-Text.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.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.html#t:Text">Text</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a><a href="src/Data-Text.html#null" class="link">Source</a></p><div class="doc"><p><em>O(1)</em> Tests whether a <code><a href="Data-Text.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.html#t:Text">Text</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a><a href="src/Data-Text.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.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.html#t:Text">Text</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Ord.html#t:Ordering">Ordering</a><a href="src/Data-Text.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.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.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:7">Transformations
</h1><div class="top"><p class="src"><a name="v:map" class="def">map</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a>) -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a><a href="src/Data-Text.html#map" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> <code><a href="Data-Text.html#v:map">map</a></code> <code>f</code> <code>t</code> is the <code><a href="Data-Text.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.html#t:Text">Text</a> -&gt; [<a href="Data-Text.html#t:Text">Text</a>] -&gt; <a href="Data-Text.html#t:Text">Text</a><a href="src/Data-Text.html#intercalate" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> The <code><a href="Data-Text.html#v:intercalate">intercalate</a></code> function takes a <code><a href="Data-Text.html#t:Text">Text</a></code> and a list of
 <code><a href="Data-Text.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="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a><a href="src/Data-Text.html#intersperse" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> The <code><a href="Data-Text.html#v:intersperse">intersperse</a></code> function takes a character and places it
 between the characters of a <code><a href="Data-Text.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.html#t:Text">Text</a>] -&gt; [<a href="Data-Text.html#t:Text">Text</a>]<a href="src/Data-Text.html#transpose" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> The <code><a href="Data-Text.html#v:transpose">transpose</a></code> function transposes the rows and columns
 of its <code><a href="Data-Text.html#t:Text">Text</a></code> argument.  Note that this function uses <code><a href="Data-Text.html#v:pack">pack</a></code>,
 <code><a href="Data-Text.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.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a><a href="src/Data-Text.html#reverse" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Reverse the characters of a string. Subject to fusion.
</p></div></div><div class="top"><p class="src"><a name="v:replace" class="def">replace</a><a href="src/Data-Text.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.html#t:Text">Text</a></td><td class="doc"><p>Text to search for
</p></td></tr><tr><td class="src">-&gt; <a href="Data-Text.html#t:Text">Text</a></td><td class="doc"><p>Replacement text
</p></td></tr><tr><td class="src">-&gt; <a href="Data-Text.html#t:Text">Text</a></td><td class="doc"><p>Input text
</p></td></tr><tr><td class="src">-&gt; <a href="Data-Text.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 occurrence of one substring with another.
</p><p>In (unlikely) bad cases, this function's time complexity degrades
 towards <em>O(n*m)</em>.
</p></div></div><h2 id="g:8">Case conversion
</h2><div class="doc"><p>When case converting <code><a href="Data-Text.html#t:Text">Text</a></code> values, do not use combinators like
 <code>map toUpper</code> to case convert each character of a string
 individually, as this gives incorrect results according to the
 rules of some writing systems.  The whole-string case conversion
 functions from this module, such as <code>toUpper</code>, obey the correct
 case conversion rules.  As a result, these functions may map one
 input character to two or three output characters. For examples,
 see the documentation of each function.
</p><p><em>Note</em>: In some languages, case conversion is a locale- and
 context-dependent operation. The case conversion functions in this
 module are <em>not</em> locale sensitive. Programs that require locale
 sensitivity should use appropriate versions of the case mapping
 functions from the <code>text-icu</code> package:
 <a href="http://hackage.haskell.org/package/text-icu">http://hackage.haskell.org/package/text-icu</a>
</p></div><div class="top"><p class="src"><a name="v:toCaseFold" class="def">toCaseFold</a> :: <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a><a href="src/Data-Text.html#toCaseFold" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Convert a string to folded case.  This function is mainly
 useful for performing caseless (also known as 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.html#v:toLower">toLower</a></code> to the input string.  For instance,
 the Armenian small ligature &quot;&#64275;&quot; (men now, U+FB13) is case
 folded to the sequence &quot;&#1396;&quot; (men, U+0574) followed by
 &quot;&#1398;&quot; (now, U+0576), while the Greek &quot;&#181;&quot; (micro sign,
 U+00B5) is case folded to &quot;&#956;&quot; (small 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.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a><a href="src/Data-Text.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.  The result string may be longer than the input string.
 For instance, &quot;&#304;&quot; (Latin capital letter I with dot above,
 U+0130) maps to the sequence &quot;i&quot; (Latin small letter i, U+0069) followed
 by &quot; &#775;&quot; (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.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a><a href="src/Data-Text.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.  The result string may be longer than the input string.
 For instance, the German &quot;&#223;&quot; (eszett, U+00DF) maps to the
 two-letter sequence &quot;SS&quot;.
</p></div></div><h2 id="g:9">Justification
</h2><div class="top"><p class="src"><a name="v:justifyLeft" class="def">justifyLeft</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a><a href="src/Data-Text.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="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a><a href="src/Data-Text.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="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a><a href="src/Data-Text.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:10">Folds
</h1><div class="top"><p class="src"><a name="v:foldl" class="def">foldl</a> ::  (a -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a> -&gt; a) -&gt; a -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; a<a href="src/Data-Text.html#foldl" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> <code><a href="Data-Text.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.html#t:Text">Text</a></code>,
 reduces the <code><a href="Data-Text.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="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a> -&gt; a) -&gt; a -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; a<a href="src/Data-Text.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.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="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a>) -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a><a href="src/Data-Text.html#foldl1" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> A variant of <code><a href="Data-Text.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.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="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a>) -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a><a href="src/Data-Text.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.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="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a> -&gt; a -&gt; a) -&gt; a -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; a<a href="src/Data-Text.html#foldr" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> <code><a href="Data-Text.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.html#t:Text">Text</a></code>,
 reduces the <code><a href="Data-Text.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="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a>) -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a><a href="src/Data-Text.html#foldr1" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> A variant of <code><a href="Data-Text.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.html#t:Text">Text</a></code>.  Subject to
 fusion.
</p></div></div><h2 id="g:11">Special folds
</h2><div class="top"><p class="src"><a name="v:concat" class="def">concat</a> :: [<a href="Data-Text.html#t:Text">Text</a>] -&gt; <a href="Data-Text.html#t:Text">Text</a><a href="src/Data-Text.html#concat" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Concatenate a list of <code><a href="Data-Text.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="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="Data-Text.html#t:Text">Text</a>) -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a><a href="src/Data-Text.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.html#t:Text">Text</a></code> that results in a <code><a href="Data-Text.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="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a>) -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a><a href="src/Data-Text.html#any" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> <code><a href="Data-Text.html#v:any">any</a></code> <code>p</code> <code>t</code> determines whether any character in the
 <code><a href="Data-Text.html#t:Text">Text</a></code> <code>t</code> satisifes 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="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a>) -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a><a href="src/Data-Text.html#all" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> <code><a href="Data-Text.html#v:all">all</a></code> <code>p</code> <code>t</code> determines whether all characters in the
 <code><a href="Data-Text.html#t:Text">Text</a></code> <code>t</code> satisify 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.html#t:Text">Text</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a><a href="src/Data-Text.html#maximum" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> <code><a href="Data-Text.html#v:maximum">maximum</a></code> returns the maximum value from a <code><a href="Data-Text.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.html#t:Text">Text</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a><a href="src/Data-Text.html#minimum" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> <code><a href="Data-Text.html#v:minimum">minimum</a></code> returns the minimum value from a <code><a href="Data-Text.html#t:Text">Text</a></code>, which
 must be non-empty. Subject to fusion.
</p></div></div><h1 id="g:12">Construction
</h1><h2 id="g:13">Scans
</h2><div class="top"><p class="src"><a name="v:scanl" class="def">scanl</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a>) -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a><a href="src/Data-Text.html#scanl" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> <code><a href="Data-Text.html#v:scanl">scanl</a></code> is similar to <code><a href="Data-Text.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="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a>) -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a><a href="src/Data-Text.html#scanl1" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> <code><a href="Data-Text.html#v:scanl1">scanl1</a></code> is a variant of <code><a href="Data-Text.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="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a>) -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a><a href="src/Data-Text.html#scanr" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> <code><a href="Data-Text.html#v:scanr">scanr</a></code> is the right-to-left dual of <code><a href="Data-Text.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="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a>) -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a><a href="src/Data-Text.html#scanr1" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> <code><a href="Data-Text.html#v:scanr1">scanr1</a></code> is a variant of <code><a href="Data-Text.html#v:scanr">scanr</a></code> that has no starting
 value argument.  Subject to fusion.  Performs replacement on
 invalid scalar values.
</p></div></div><h2 id="g:14">Accumulating maps
</h2><div class="top"><p class="src"><a name="v:mapAccumL" class="def">mapAccumL</a> ::  (a -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a> -&gt; (a, <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a>)) -&gt; a -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; (a, <a href="Data-Text.html#t:Text">Text</a>)<a href="src/Data-Text.html#mapAccumL" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Like a combination of <code><a href="Data-Text.html#v:map">map</a></code> and <code><a href="Data-Text.html#v:foldl-39-">foldl'</a></code>. Applies a
 function to each element of a <code><a href="Data-Text.html#t:Text">Text</a></code>, passing an accumulating
 parameter from left to right, and returns a final <code><a href="Data-Text.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="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a> -&gt; (a, <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a>)) -&gt; a -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; (a, <a href="Data-Text.html#t:Text">Text</a>)<a href="src/Data-Text.html#mapAccumR" class="link">Source</a></p><div class="doc"><p>The <code><a href="Data-Text.html#v:mapAccumR">mapAccumR</a></code> function behaves like a combination of <code><a href="Data-Text.html#v:map">map</a></code> and
 a strict <code><a href="Data-Text.html#v:foldr">foldr</a></code>; it applies a function to each element of a
 <code><a href="Data-Text.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.html#t:Text">Text</a></code>.
 Performs replacement on invalid scalar values.
</p></div></div><h2 id="g:15">Generation and unfolding
</h2><div class="top"><p class="src"><a name="v:replicate" class="def">replicate</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a><a href="src/Data-Text.html#replicate" class="link">Source</a></p><div class="doc"><p><em>O(n*m)</em> <code><a href="Data-Text.html#v:replicate">replicate</a></code> <code>n</code> <code>t</code> is a <code><a href="Data-Text.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:unfoldr" class="def">unfoldr</a> ::  (a -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Maybe.html#t:Maybe">Maybe</a> (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a>, a)) -&gt; a -&gt; <a href="Data-Text.html#t:Text">Text</a><a href="src/Data-Text.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.html#v:unfoldr">unfoldr</a></code>
 function is analogous to the List <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-List.html#v:unfoldr">unfoldr</a></code>. <code><a href="Data-Text.html#v:unfoldr">unfoldr</a></code> builds a
 <code><a href="Data-Text.html#t:Text">Text</a></code> from a seed value. The function takes the element and
 returns <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Maybe.html#v:Nothing">Nothing</a></code> if it is done producing the <code><a href="Data-Text.html#t:Text">Text</a></code>, otherwise
 <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.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="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a></code> in the
 string, and <code>b</code> is the seed value for further production. Subject
 to fusion.  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="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -&gt; (a -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Maybe.html#t:Maybe">Maybe</a> (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a>, a)) -&gt; a -&gt; <a href="Data-Text.html#t:Text">Text</a><a href="src/Data-Text.html#unfoldrN" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Like <code><a href="Data-Text.html#v:unfoldr">unfoldr</a></code>, <code><a href="Data-Text.html#v:unfoldrN">unfoldrN</a></code> builds a <code><a href="Data-Text.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.html#v:unfoldrN">unfoldrN</a></code>. This function is more efficient than
 <code><a href="Data-Text.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.html#v:unfoldr">unfoldr</a></code>. Subject
 to fusion.  Performs replacement on invalid scalar values.
</p></div></div><h1 id="g:16">Substrings
</h1><h2 id="g:17">Breaking strings
</h2><div class="top"><p class="src"><a name="v:take" class="def">take</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a><a href="src/Data-Text.html#take" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> <code><a href="Data-Text.html#v:take">take</a></code> <code>n</code>, applied to a <code><a href="Data-Text.html#t:Text">Text</a></code>, returns the prefix of the
 <code><a href="Data-Text.html#t:Text">Text</a></code> of length <code>n</code>, or the <code><a href="Data-Text.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:drop" class="def">drop</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a><a href="src/Data-Text.html#drop" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> <code><a href="Data-Text.html#v:drop">drop</a></code> <code>n</code>, applied to a <code><a href="Data-Text.html#t:Text">Text</a></code>, returns the suffix of the
 <code><a href="Data-Text.html#t:Text">Text</a></code> after the first <code>n</code> characters, or the empty <code><a href="Data-Text.html#t:Text">Text</a></code> if <code>n</code>
 is greater than the length of the <code><a href="Data-Text.html#t:Text">Text</a></code>. Subject to fusion.
</p></div></div><div class="top"><p class="src"><a name="v:takeWhile" class="def">takeWhile</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a>) -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a><a href="src/Data-Text.html#takeWhile" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> <code><a href="Data-Text.html#v:takeWhile">takeWhile</a></code>, applied to a predicate <code>p</code> and a <code><a href="Data-Text.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:dropWhile" class="def">dropWhile</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a>) -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a><a href="src/Data-Text.html#dropWhile" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> <code><a href="Data-Text.html#v:dropWhile">dropWhile</a></code> <code>p</code> <code>t</code> returns the suffix remaining after
 <code><a href="Data-Text.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="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a>) -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a><a href="src/Data-Text.html#dropWhileEnd" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> <code><a href="Data-Text.html#v:dropWhileEnd">dropWhileEnd</a></code> <code>p</code> <code>t</code> returns the prefix remaining after
 dropping characters that fail the predicate <code>p</code> from the end of
 <code>t</code>.  Subject to fusion.
 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="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a>) -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a><a href="src/Data-Text.html#dropAround" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> <code><a href="Data-Text.html#v:dropAround">dropAround</a></code> <code>p</code> <code>t</code> returns the substring remaining after
 dropping characters that fail 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.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a><a href="src/Data-Text.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.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a><a href="src/Data-Text.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.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a><a href="src/Data-Text.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="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; (<a href="Data-Text.html#t:Text">Text</a>, <a href="Data-Text.html#t:Text">Text</a>)<a href="src/Data-Text.html#splitAt" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> <code><a href="Data-Text.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.html#v:take">take</a></code> n t, <code><a href="Data-Text.html#v:drop">drop</a></code> n t)</code>.
</p></div></div><div class="top"><p class="src"><a name="v:breakOn" class="def">breakOn</a> :: <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; (<a href="Data-Text.html#t:Text">Text</a>, <a href="Data-Text.html#t:Text">Text</a>)<a href="src/Data-Text.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.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.html#v:breakOnAll">breakOnAll</a></code>
 instead, as it has lower startup overhead.
</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.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; (<a href="Data-Text.html#t:Text">Text</a>, <a href="Data-Text.html#t:Text">Text</a>)<a href="src/Data-Text.html#breakOnEnd" class="link">Source</a></p><div class="doc"><p><em>O(n+m)</em> Similar to <code><a href="Data-Text.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="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a>) -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; (<a href="Data-Text.html#t:Text">Text</a>, <a href="Data-Text.html#t:Text">Text</a>)<a href="src/Data-Text.html#break" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> <code><a href="Data-Text.html#v:break">break</a></code> is like <code><a href="Data-Text.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:span" class="def">span</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a>) -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; (<a href="Data-Text.html#t:Text">Text</a>, <a href="Data-Text.html#t:Text">Text</a>)<a href="src/Data-Text.html#span" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> <code><a href="Data-Text.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:group" class="def">group</a> :: <a href="Data-Text.html#t:Text">Text</a> -&gt; [<a href="Data-Text.html#t:Text">Text</a>]<a href="src/Data-Text.html#group" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Group characters in a string by equality.
</p></div></div><div class="top"><p class="src"><a name="v:groupBy" class="def">groupBy</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a>) -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; [<a href="Data-Text.html#t:Text">Text</a>]<a href="src/Data-Text.html#groupBy" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Group characters in a string according to a predicate.
</p></div></div><div class="top"><p class="src"><a name="v:inits" class="def">inits</a> :: <a href="Data-Text.html#t:Text">Text</a> -&gt; [<a href="Data-Text.html#t:Text">Text</a>]<a href="src/Data-Text.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.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.html#t:Text">Text</a> -&gt; [<a href="Data-Text.html#t:Text">Text</a>]<a href="src/Data-Text.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.html#t:Text">Text</a></code>, longest
 first.
</p></div></div><h2 id="g:18">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.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="Data-Text.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; [<a href="Data-Text.html#t:Text">Text</a>]<a href="src/Data-Text.html#splitOn" class="link">Source</a></p><div class="doc"><p><em>O(m+n)</em> Break a <code><a href="Data-Text.html#t:Text">Text</a></code> into pieces separated by the first
 <code><a href="Data-Text.html#t:Text">Text</a></code> argument, 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>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="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a>) -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; [<a href="Data-Text.html#t:Text">Text</a>]<a href="src/Data-Text.html#split" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Splits a <code><a href="Data-Text.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;        == [&quot;&quot;]
</pre></div></div><div class="top"><p class="src"><a name="v:chunksOf" class="def">chunksOf</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; [<a href="Data-Text.html#t:Text">Text</a>]<a href="src/Data-Text.html#chunksOf" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Splits a <code><a href="Data-Text.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:19">Breaking into lines and words
</h2><div class="top"><p class="src"><a name="v:lines" class="def">lines</a> :: <a href="Data-Text.html#t:Text">Text</a> -&gt; [<a href="Data-Text.html#t:Text">Text</a>]<a href="src/Data-Text.html#lines" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Breaks a <code><a href="Data-Text.html#t:Text">Text</a></code> up into a list of <code><a href="Data-Text.html#t:Text">Text</a></code>s at
 newline <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.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.html#t:Text">Text</a> -&gt; [<a href="Data-Text.html#t:Text">Text</a>]<a href="src/Data-Text.html#words" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> Breaks a <code><a href="Data-Text.html#t:Text">Text</a></code> up into a list of words, delimited by <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.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.html#t:Text">Text</a>] -&gt; <a href="Data-Text.html#t:Text">Text</a><a href="src/Data-Text.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.html#t:Text">Text</a>] -&gt; <a href="Data-Text.html#t:Text">Text</a><a href="src/Data-Text.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:20">Predicates
</h1><div class="top"><p class="src"><a name="v:isPrefixOf" class="def">isPrefixOf</a> :: <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a><a href="src/Data-Text.html#isPrefixOf" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> The <code><a href="Data-Text.html#v:isPrefixOf">isPrefixOf</a></code> function takes two <code><a href="Data-Text.html#t:Text">Text</a></code>s and returns
 <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.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.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a><a href="src/Data-Text.html#isSuffixOf" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> The <code><a href="Data-Text.html#v:isSuffixOf">isSuffixOf</a></code> function takes two <code><a href="Data-Text.html#t:Text">Text</a></code>s and returns
 <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.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.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a><a href="src/Data-Text.html#isInfixOf" class="link">Source</a></p><div class="doc"><p><em>O(n+m)</em> The <code><a href="Data-Text.html#v:isInfixOf">isInfixOf</a></code> function takes two <code><a href="Data-Text.html#t:Text">Text</a></code>s and returns
 <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Bool.html#v:True">True</a></code> iff the first is contained, wholly and intact, anywhere
 within the 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:21">View patterns
</h2><div class="top"><p class="src"><a name="v:stripPrefix" class="def">stripPrefix</a> :: <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="Data-Text.html#t:Text">Text</a><a href="src/Data-Text.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 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.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="Data-Text.html#t:Text">Text</a><a href="src/Data-Text.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 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.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Maybe.html#t:Maybe">Maybe</a> (<a href="Data-Text.html#t:Text">Text</a>, <a href="Data-Text.html#t:Text">Text</a>, <a href="Data-Text.html#t:Text">Text</a>)<a href="src/Data-Text.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="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.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:22">Searching
</h1><div class="top"><p class="src"><a name="v:filter" class="def">filter</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a>) -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a><a href="src/Data-Text.html#filter" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> <code><a href="Data-Text.html#v:filter">filter</a></code>, applied to a predicate and a <code><a href="Data-Text.html#t:Text">Text</a></code>,
 returns a <code><a href="Data-Text.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:breakOnAll" class="def">breakOnAll</a><a href="src/Data-Text.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.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.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.html#t:Text">Text</a>, <a href="Data-Text.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>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:find" class="def">find</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a>) -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a><a href="src/Data-Text.html#find" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> The <code><a href="Data-Text.html#v:find">find</a></code> function takes a predicate and a <code><a href="Data-Text.html#t:Text">Text</a></code>, and
 returns the first element matching the predicate, or <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.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:partition" class="def">partition</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a>) -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; (<a href="Data-Text.html#t:Text">Text</a>, <a href="Data-Text.html#t:Text">Text</a>)<a href="src/Data-Text.html#partition" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> The <code><a href="Data-Text.html#v:partition">partition</a></code> function takes a predicate and a <code><a href="Data-Text.html#t:Text">Text</a></code>,
 and returns the pair of <code><a href="Data-Text.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:23">Indexing
</h1><div class="doc"><p>If you think of a <code><a href="Data-Text.html#t:Text">Text</a></code> value as an array of <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a></code> values (which
 it is not), you run the risk of writing inefficient code.
</p><p>An idiom that is common in some languages is to find the numeric
 offset of a character or substring, then use that number to split
 or trim the searched string.  With a <code><a href="Data-Text.html#t:Text">Text</a></code> value, this approach
 would require two <em>O(n)</em> operations: one to perform the search, and
 one to operate from wherever the search ended.
</p><p>For example, suppose you have a string that you want to split on
 the substring <code>&quot;::&quot;</code>, such as <code>&quot;foo::bar::quux&quot;</code>. Instead of
 searching for the index of <code>&quot;::&quot;</code> and taking the substrings
 before and after that index, you would instead use <code>breakOnAll &quot;::&quot;</code>.
</p></div><div class="top"><p class="src"><a name="v:index" class="def">index</a> :: <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a><a href="src/Data-Text.html#index" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> <code><a href="Data-Text.html#t:Text">Text</a></code> index (subscript) operator, starting from 0.
</p></div></div><div class="top"><p class="src"><a name="v:findIndex" class="def">findIndex</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a>) -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a><a href="src/Data-Text.html#findIndex" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> The <code><a href="Data-Text.html#v:findIndex">findIndex</a></code> function takes a predicate and a <code><a href="Data-Text.html#t:Text">Text</a></code>
 and returns the index of the first element in the <code><a href="Data-Text.html#t:Text">Text</a></code> satisfying
 the predicate. Subject to fusion.
</p></div></div><div class="top"><p class="src"><a name="v:count" class="def">count</a> :: <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a><a href="src/Data-Text.html#count" class="link">Source</a></p><div class="doc"><p><em>O(n+m)</em> The <code><a href="Data-Text.html#v:count">count</a></code> function returns the number of times the
 query string appears in the given <code><a href="Data-Text.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:24">Zipping and unzipping
</h1><div class="top"><p class="src"><a name="v:zip" class="def">zip</a> :: <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; [(<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a>, <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a>)]<a href="src/Data-Text.html#zip" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> <code><a href="Data-Text.html#v:zip">zip</a></code> takes two <code><a href="Data-Text.html#t:Text">Text</a></code>s and returns a list of
 corresponding pairs of bytes. If one input <code><a href="Data-Text.html#t:Text">Text</a></code> is short,
 excess elements of the longer <code><a href="Data-Text.html#t:Text">Text</a></code> are discarded. This is
 equivalent to a pair of <code><a href="Data-Text.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="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Char.html#t:Char">Char</a>) -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a><a href="src/Data-Text.html#zipWith" class="link">Source</a></p><div class="doc"><p><em>O(n)</em> <code><a href="Data-Text.html#v:zipWith">zipWith</a></code> generalises <code><a href="Data-Text.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.10.0</p></div></body></html>