This file is indexed.

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

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

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
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
<!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 src="file:///usr/share/javascript/mathjax/MathJax.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-1.2.2.2: An efficient packed Unicode text type.</p></div><div id="content"><div id="module-header"><table class="info"><tr><th valign="top">Copyright</th><td>(c) 2009 2010 2011 2012 Bryan O'Sullivan<br />(c) 2009 Duncan Coutts<br />(c) 2008 2009 Tom Harper</td></tr><tr><th>License</th><td>BSD-style</td></tr><tr><th>Maintainer</th><td>bos@serpentine.com</td></tr><tr><th>Stability</th><td>experimental</td></tr><tr><th>Portability</th><td>GHC</td></tr><tr><th>Safe Haskell</th><td>Trustworthy</td></tr><tr><th>Language</th><td>Haskell98</td></tr></table><p class="caption">Data.Text</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</a></li><li><a href="#g:25">Low level operations</a></li><li><a href="#section.orphans">Orphan instances</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="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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
 <a href="http://hackage.haskell.org/package/text-icu">the text-icu package</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="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-String.html#t:String">String</a></li><li class="src short"><a href="#v:singleton">singleton</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Maybe.html#t:Maybe">Maybe</a> (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Int.html#t:Int">Int</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Ord.html#t:Ordering">Ordering</a></li><li class="src short"><a href="#v:map">map</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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:toTitle">toTitle</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="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Int.html#t:Int">Int</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Int.html#t:Int">Int</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Int.html#t:Int">Int</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a>) -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a></li><li class="src short"><a href="#v:foldl1-39-">foldl1'</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a>) -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a></li><li class="src short"><a href="#v:foldr">foldr</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a>) -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a>) -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><a href="#v:all">all</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a>) -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a></li><li class="src short"><a href="#v:scanl">scanl</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a>) -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a>) -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a> -&gt; (a, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a> -&gt; (a, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Maybe.html#t:Maybe">Maybe</a> (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Int.html#t:Int">Int</a> -&gt; (a -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Maybe.html#t:Maybe">Maybe</a> (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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:takeEnd">takeEnd</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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:dropEnd">dropEnd</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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:takeWhileEnd">takeWhileEnd</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a>) -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a></li><li class="src short"><a href="#v:partition">partition</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Int.html#t:Int">Int</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a></li><li class="src short"><a href="#v:findIndex">findIndex</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a>) -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a>, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a>)]</li><li class="src short"><a href="#v:zipWith">zipWith</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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:copy">copy</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:unpackCString-35-">unpackCString#</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/ghc-prim-0.5.0.0/GHC-Prim.html#t:Addr-35-">Addr#</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 <a href="Data-Text.html">Data.Text</a> module, while the lazy
 type is provided by the <a href="Data-Text-Lazy.html">Data.Text.Lazy</a> module. 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><a href="Data-Text-Lazy.html#v:Text">Text</a></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><a href="Data-Text-Lazy.html#v:Text">Text</a></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="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Int.html#t:Int">Int</a></code> values for
 lengths and counts, while the lazy module uses <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Int.html#v:Int64">Int64</a></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
 <a href="http://www.unicode.org/versions/Unicode5.2.0/ch03.pdf#page=35">&#167;3.9, definition D76 of the Unicode 5.2 standard</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
 (<a href="http://www.unicode.org/versions/Unicode5.2.0/ch03.pdf#page=13">&#167;3.4, definition D10</a>)
 as <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a></code> values, including code points from this invalid range.
 This means that there are some <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a></code> values. Those functions will substitute <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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
 <a href="http://unicode.org/reports/tr36/#Deletion_of_Noncharacters">Unicode Technical Report 36, &#167;3.5</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><a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString.html#v:ByteString">ByteString</a></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><a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString.html#v:ByteString">ByteString</a></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 id="t:Text" class="def">Text</a> <a href="src/Data-Text-Internal.html#Text" class="link">Source</a> <a href="#t:Text" class="selflink">#</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 clearfix"><span class="inst-left"><span id="control.i:id:Text:Item:1" class="instance expander" onclick="toggleSection('i:id:Text:Item:1')"></span> <span class="keyword">type</span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/GHC-Exts.html#t:Item">Item</a> <a href="Data-Text.html#t:Text">Text</a></span> <a href="#t:Item" class="selflink">#</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><div id="section.i:id:Text:Item:1" class="inst-details hide"><div class="src"><span class="keyword">type</span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/GHC-Exts.html#t:Item">Item</a> <a href="Data-Text.html#t:Text">Text</a> = <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a></div></div></td></tr></table></div></div></div><h1 id="g:5">Creation and elimination</h1><div class="top"><p class="src"><a id="v:pack" class="def">pack</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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> <a href="#v:pack" class="selflink">#</a></p><div class="doc"><p><em>O(n)</em> Convert a <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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 id="v:unpack" class="def">unpack</a> :: <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-String.html#t:String">String</a> <a href="src/Data-Text-Show.html#unpack" class="link">Source</a> <a href="#v:unpack" class="selflink">#</a></p><div class="doc"><p><em>O(n)</em> Convert a <code><a href="Data-Text.html#t:Text">Text</a></code> into a <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-String.html#t:String">String</a></code>.  Subject to fusion.</p></div></div><div class="top"><p class="src"><a id="v:singleton" class="def">singleton</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="Data-Text.html#t:Text">Text</a> <a href="src/Data-Text-Show.html#singleton" class="link">Source</a> <a href="#v:singleton" class="selflink">#</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 id="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> <a href="#v:empty" class="selflink">#</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 id="v:cons" class="def">cons</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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> <span class="fixity">infixr 5</span><span class="rightedge"></span> <a href="src/Data-Text.html#cons" class="link">Source</a> <a href="#v:cons" class="selflink">#</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 id="v:snoc" class="def">snoc</a> :: <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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> <a href="#v:snoc" class="selflink">#</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 id="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> <a href="#v:append" class="selflink">#</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 id="v:uncons" class="def">uncons</a> :: <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Maybe.html#t:Maybe">Maybe</a> (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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> <a href="#v:uncons" class="selflink">#</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="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Maybe.html#v:Nothing">Nothing</a></code> if empty. Subject to fusion.</p></div></div><div class="top"><p class="src"><a id="v:head" class="def">head</a> :: <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a> <a href="src/Data-Text.html#head" class="link">Source</a> <a href="#v:head" class="selflink">#</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 id="v:last" class="def">last</a> :: <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a> <a href="src/Data-Text.html#last" class="link">Source</a> <a href="#v:last" class="selflink">#</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 id="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> <a href="#v:tail" class="selflink">#</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 id="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> <a href="#v:init" class="selflink">#</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 id="v:null" class="def">null</a> :: <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a> <a href="src/Data-Text.html#null" class="link">Source</a> <a href="#v:null" class="selflink">#</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 id="v:length" class="def">length</a> :: <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Int.html#t:Int">Int</a> <a href="src/Data-Text.html#length" class="link">Source</a> <a href="#v:length" class="selflink">#</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 id="v:compareLength" class="def">compareLength</a> :: <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Int.html#t:Int">Int</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Ord.html#t:Ordering">Ordering</a> <a href="src/Data-Text.html#compareLength" class="link">Source</a> <a href="#v:compareLength" class="selflink">#</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 id="v:map" class="def">map</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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> <a href="#v:map" class="selflink">#</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 id="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> <a href="#v:intercalate" class="selflink">#</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 id="v:intersperse" class="def">intersperse</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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> <a href="#v:intersperse" class="selflink">#</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 id="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> <a href="#v:transpose" class="selflink">#</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 id="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> <a href="#v:reverse" class="selflink">#</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 id="v:replace" class="def">replace</a> <a href="src/Data-Text.html#replace" class="link">Source</a> <a href="#v:replace" class="selflink">#</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.  If this string is empty, an
 error will occur.</p></td></tr><tr><td class="src">-&gt; <a href="Data-Text.html#t:Text">Text</a></td><td class="doc"><p><code>replacement</code> to replace <code>needle</code> with.</p></td></tr><tr><td class="src">-&gt; <a href="Data-Text.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></td><td class="doc empty">&nbsp;</td></tr></table></div><div class="doc"><p><em>O(m+n)</em> Replace every non-overlapping occurrence of <code>needle</code> in
 <code>haystack</code> with <code>replacement</code>.</p><p>This function behaves as though it was defined as follows:</p><pre>replace needle replacement haystack =
  <code><a href="Data-Text.html#v:intercalate">intercalate</a></code> replacement (<code><a href="Data-Text.html#v:splitOn">splitOn</a></code> needle haystack)
</pre><p>As this suggests, each occurrence is replaced exactly once.  So if
 <code>needle</code> occurs in <code>replacement</code>, that occurrence will <em>not</em> itself
 be replaced recursively:</p><pre>replace &quot;oo&quot; &quot;foo&quot; &quot;oo&quot; == &quot;foo&quot;</pre><p>In cases where several instances of <code>needle</code> overlap, only the
 first one will be replaced:</p><pre>replace &quot;ofo&quot; &quot;bar&quot; &quot;ofofo&quot; == &quot;barfo&quot;</pre><p>In (unlikely) bad cases, this function's time complexity degrades
 towards <em>O(n*m)</em>.</p></div></div><h2 id="g: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
 <a href="http://hackage.haskell.org/package/text-icu-0.6.3.7/docs/Data-Text-ICU.html#g:4">case mapping functions from the text-icu package</a>.</p></div><div class="top"><p class="src"><a id="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> <a href="#v:toCaseFold" class="selflink">#</a></p><div class="doc"><p><em>O(n)</em> Convert a string to folded case.  Subject to fusion.</p><p>This function is mainly useful for performing caseless (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 id="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> <a href="#v:toLower" class="selflink">#</a></p><div class="doc"><p><em>O(n)</em> Convert a string to lower case, using simple case
 conversion.  Subject to fusion.</p><p>The result string may be longer than the input string.  For
 instance, &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 id="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> <a href="#v:toUpper" class="selflink">#</a></p><div class="doc"><p><em>O(n)</em> Convert a string to upper case, using simple case
 conversion.  Subject to fusion.</p><p>The result string may be longer than the input string.  For
 instance, the German &quot;&#223;&quot; (eszett, U+00DF) maps to the
 two-letter sequence &quot;SS&quot;.</p></div></div><div class="top"><p class="src"><a id="v:toTitle" class="def">toTitle</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#toTitle" class="link">Source</a> <a href="#v:toTitle" class="selflink">#</a></p><div class="doc"><p><em>O(n)</em> Convert a string to title case, using simple case
 conversion. Subject to fusion.</p><p>The first letter of the input is converted to title case, as is
 every subsequent letter that immediately follows a non-letter.
 Every letter that immediately follows another letter is converted
 to lower case.</p><p>The result string may be longer than the input string. For example,
 the Latin small ligature &#64258; (U+FB02) is converted to the
 sequence Latin capital letter F (U+0046) followed by Latin small
 letter l (U+006C).</p><p><em>Note</em>: this function does not take language or culture specific
 rules into account. For instance, in English, different style
 guides disagree on whether the book name &quot;The Hill of the Red
 Fox&quot; is correctly title cased&#8212;but this function will
 capitalize <em>every</em> word.</p></div></div><h2 id="g:9">Justification</h2><div class="top"><p class="src"><a id="v:justifyLeft" class="def">justifyLeft</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Int.html#t:Int">Int</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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> <a href="#v:justifyLeft" class="selflink">#</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 id="v:justifyRight" class="def">justifyRight</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Int.html#t:Int">Int</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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> <a href="#v:justifyRight" class="selflink">#</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 id="v:center" class="def">center</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Int.html#t:Int">Int</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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> <a href="#v:center" class="selflink">#</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 id="v:foldl" class="def">foldl</a> :: (a -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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> <a href="#v:foldl" class="selflink">#</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 id="v:foldl-39-" class="def">foldl'</a> :: (a -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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> <a href="#v:foldl-39-" class="selflink">#</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 id="v:foldl1" class="def">foldl1</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a>) -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a> <a href="src/Data-Text.html#foldl1" class="link">Source</a> <a href="#v:foldl1" class="selflink">#</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 id="v:foldl1-39-" class="def">foldl1'</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a>) -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a> <a href="src/Data-Text.html#foldl1%27" class="link">Source</a> <a href="#v:foldl1-39-" class="selflink">#</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 id="v:foldr" class="def">foldr</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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> <a href="#v:foldr" class="selflink">#</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 id="v:foldr1" class="def">foldr1</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a>) -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a> <a href="src/Data-Text.html#foldr1" class="link">Source</a> <a href="#v:foldr1" class="selflink">#</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 id="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> <a href="#v:concat" class="selflink">#</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 id="v:concatMap" class="def">concatMap</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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> <a href="#v:concatMap" class="selflink">#</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 id="v:any" class="def">any</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a>) -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a> <a href="src/Data-Text.html#any" class="link">Source</a> <a href="#v:any" class="selflink">#</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> satisfies the predicate <code>p</code>. Subject to fusion.</p></div></div><div class="top"><p class="src"><a id="v:all" class="def">all</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a>) -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a> <a href="src/Data-Text.html#all" class="link">Source</a> <a href="#v:all" class="selflink">#</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> satisfy the predicate <code>p</code>. Subject to fusion.</p></div></div><div class="top"><p class="src"><a id="v:maximum" class="def">maximum</a> :: <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a> <a href="src/Data-Text.html#maximum" class="link">Source</a> <a href="#v:maximum" class="selflink">#</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 id="v:minimum" class="def">minimum</a> :: <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a> <a href="src/Data-Text.html#minimum" class="link">Source</a> <a href="#v:minimum" class="selflink">#</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 id="v:scanl" class="def">scanl</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a>) -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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> <a href="#v:scanl" class="selflink">#</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 id="v:scanl1" class="def">scanl1</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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> <a href="#v:scanl1" class="selflink">#</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 id="v:scanr" class="def">scanr</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a>) -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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> <a href="#v:scanr" class="selflink">#</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 id="v:scanr1" class="def">scanr1</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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> <a href="#v:scanr1" class="selflink">#</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 id="v:mapAccumL" class="def">mapAccumL</a> :: (a -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a> -&gt; (a, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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> <a href="#v:mapAccumL" class="selflink">#</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 id="v:mapAccumR" class="def">mapAccumR</a> :: (a -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a> -&gt; (a, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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> <a href="#v:mapAccumR" class="selflink">#</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 id="v:replicate" class="def">replicate</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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> <a href="#v:replicate" class="selflink">#</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 id="v:unfoldr" class="def">unfoldr</a> :: (a -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Maybe.html#t:Maybe">Maybe</a> (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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> <a href="#v:unfoldr" class="selflink">#</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="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/GHC-OldList.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="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Maybe.html#v:Just">Just</a></code> <code>(a,b)</code>.  In this case, <code>a</code> is the next <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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 id="v:unfoldrN" class="def">unfoldrN</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Int.html#t:Int">Int</a> -&gt; (a -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Maybe.html#t:Maybe">Maybe</a> (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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> <a href="#v:unfoldrN" class="selflink">#</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 id="v:take" class="def">take</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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> <a href="#v:take" class="selflink">#</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 id="v:takeEnd" class="def">takeEnd</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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#takeEnd" class="link">Source</a> <a href="#v:takeEnd" class="selflink">#</a></p><div class="doc"><p><em>O(n)</em> <code><a href="Data-Text.html#v:takeEnd">takeEnd</a></code> <code>n</code> <code>t</code> returns the suffix remaining after
 taking <code>n</code> characters from the end of <code>t</code>.</p><p>Examples:</p><pre>takeEnd 3 &quot;foobar&quot; == &quot;bar&quot;</pre></div></div><div class="top"><p class="src"><a id="v:drop" class="def">drop</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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> <a href="#v:drop" class="selflink">#</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 id="v:dropEnd" class="def">dropEnd</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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#dropEnd" class="link">Source</a> <a href="#v:dropEnd" class="selflink">#</a></p><div class="doc"><p><em>O(n)</em> <code><a href="Data-Text.html#v:dropEnd">dropEnd</a></code> <code>n</code> <code>t</code> returns the prefix remaining after
 dropping <code>n</code> characters from the end of <code>t</code>.</p><p>Examples:</p><pre>dropEnd 3 &quot;foobar&quot; == &quot;foo&quot;</pre></div></div><div class="top"><p class="src"><a id="v:takeWhile" class="def">takeWhile</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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> <a href="#v:takeWhile" class="selflink">#</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 id="v:takeWhileEnd" class="def">takeWhileEnd</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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#takeWhileEnd" class="link">Source</a> <a href="#v:takeWhileEnd" class="selflink">#</a></p><div class="doc"><p><em>O(n)</em> <code><a href="Data-Text.html#v:takeWhileEnd">takeWhileEnd</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 suffix (possibly empty) of elements that
 satisfy <code>p</code>.  Subject to fusion.
 Examples:</p><pre>takeWhileEnd (=='o') &quot;foo&quot; == &quot;oo&quot;</pre></div></div><div class="top"><p class="src"><a id="v:dropWhile" class="def">dropWhile</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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> <a href="#v:dropWhile" class="selflink">#</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 id="v:dropWhileEnd" class="def">dropWhileEnd</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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> <a href="#v:dropWhileEnd" class="selflink">#</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 satisfy the predicate <code>p</code> from the end of
 <code>t</code>.  Subject to fusion.</p><p>Examples:</p><pre>dropWhileEnd (=='.') &quot;foo...&quot; == &quot;foo&quot;</pre></div></div><div class="top"><p class="src"><a id="v:dropAround" class="def">dropAround</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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> <a href="#v:dropAround" class="selflink">#</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 satisfy the predicate <code>p</code> from both the
 beginning and end of <code>t</code>.  Subject to fusion.</p></div></div><div class="top"><p class="src"><a id="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> <a href="#v:strip" class="selflink">#</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 id="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> <a href="#v:stripStart" class="selflink">#</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 id="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> <a href="#v:stripEnd" class="selflink">#</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 id="v:splitAt" class="def">splitAt</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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> <a href="#v:splitAt" class="selflink">#</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 id="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> <a href="#v:breakOn" class="selflink">#</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 id="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> <a href="#v:breakOnEnd" class="selflink">#</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 id="v:break" class="def">break</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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> <a href="#v:break" class="selflink">#</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 id="v:span" class="def">span</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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> <a href="#v:span" class="selflink">#</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 id="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> <a href="#v:group" class="selflink">#</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 id="v:groupBy" class="def">groupBy</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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> <a href="#v:groupBy" class="selflink">#</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 id="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> <a href="#v:inits" class="selflink">#</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 id="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> <a href="#v:tails" class="selflink">#</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 id="v:splitOn" class="def">splitOn</a> <a href="src/Data-Text.html#splitOn" class="link">Source</a> <a href="#v:splitOn" class="selflink">#</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>String to split on. If this string is empty, an error
 will occur.</p></td></tr><tr><td class="src">-&gt; <a href="Data-Text.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> 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 (which cannot be empty), consuming the delimiter. An empty
 delimiter is invalid, and will cause an error to be raised.</p><p>Examples:</p><pre>splitOn &quot;\r\n&quot; &quot;a\r\nb\r\nd\r\ne&quot; == [&quot;a&quot;,&quot;b&quot;,&quot;d&quot;,&quot;e&quot;]
splitOn &quot;aaa&quot;  &quot;aaaXaaaXaaaXaaa&quot;  == [&quot;&quot;,&quot;X&quot;,&quot;X&quot;,&quot;X&quot;,&quot;&quot;]
splitOn &quot;x&quot;    &quot;x&quot;                == [&quot;&quot;,&quot;&quot;]</pre><p>and</p><pre>intercalate s . splitOn s         == id
splitOn (singleton c)             == split (==c)</pre><p>(Note: the string <code>s</code> to split on above cannot be empty.)</p><p>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 id="v:split" class="def">split</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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> <a href="#v:split" class="selflink">#</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 id="v:chunksOf" class="def">chunksOf</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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> <a href="#v:chunksOf" class="selflink">#</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 id="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> <a href="#v:lines" class="selflink">#</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="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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 id="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> <a href="#v:words" class="selflink">#</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="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a></code>s
 representing white space.</p></div></div><div class="top"><p class="src"><a id="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> <a href="#v:unlines" class="selflink">#</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 id="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> <a href="#v:unwords" class="selflink">#</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 id="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="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a> <a href="src/Data-Text.html#isPrefixOf" class="link">Source</a> <a href="#v:isPrefixOf" class="selflink">#</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="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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 id="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="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a> <a href="src/Data-Text.html#isSuffixOf" class="link">Source</a> <a href="#v:isSuffixOf" class="selflink">#</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="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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 id="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="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a> <a href="src/Data-Text.html#isInfixOf" class="link">Source</a> <a href="#v:isInfixOf" class="selflink">#</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="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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 id="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="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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> <a href="#v:stripPrefix" class="selflink">#</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 id="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="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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> <a href="#v:stripSuffix" class="selflink">#</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 id="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="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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> <a href="#v:commonPrefixes" class="selflink">#</a></p><div class="doc"><p><em>O(n)</em> Find the longest non-empty common prefix of two strings
 and return it, along with the suffixes of each string at which they
 no longer match.</p><p>If the strings do not have a common prefix or either one is empty,
 this function returns <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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 id="v:filter" class="def">filter</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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> <a href="#v:filter" class="selflink">#</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 id="v:breakOnAll" class="def">breakOnAll</a> <a href="src/Data-Text.html#breakOnAll" class="link">Source</a> <a href="#v:breakOnAll" class="selflink">#</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 id="v:find" class="def">find</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a>) -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a> <a href="src/Data-Text.html#find" class="link">Source</a> <a href="#v:find" class="selflink">#</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="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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 id="v:partition" class="def">partition</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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> <a href="#v:partition" class="selflink">#</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="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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 id="v:index" class="def">index</a> :: <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Int.html#t:Int">Int</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a> <a href="src/Data-Text.html#index" class="link">Source</a> <a href="#v:index" class="selflink">#</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 id="v:findIndex" class="def">findIndex</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a>) -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Int.html#t:Int">Int</a> <a href="src/Data-Text.html#findIndex" class="link">Source</a> <a href="#v:findIndex" class="selflink">#</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 id="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="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Int.html#t:Int">Int</a> <a href="src/Data-Text.html#count" class="link">Source</a> <a href="#v:count" class="selflink">#</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</h1><div class="top"><p class="src"><a id="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="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a>, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a>)] <a href="src/Data-Text.html#zip" class="link">Source</a> <a href="#v:zip" class="selflink">#</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 id="v:zipWith" class="def">zipWith</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Char.html#t:Char">Char</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.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> <a href="#v:zipWith" class="selflink">#</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><h1 id="g:25">Low level operations</h1><div class="top"><p class="src"><a id="v:copy" class="def">copy</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#copy" class="link">Source</a> <a href="#v:copy" class="selflink">#</a></p><div class="doc"><p><em>O(n)</em> Make a distinct copy of the given string, sharing no
 storage with the original string.</p><p>As an example, suppose you read a large string, of which you need
 only a small portion.  If you do not use <code><a href="Data-Text.html#v:copy">copy</a></code>, the entire original
 array will be kept alive in memory by the smaller string. Making a
 copy &quot;breaks the link&quot; to the original array, allowing it to be
 garbage collected if there are no other live references to it.</p></div></div><div class="top"><p class="src"><a id="v:unpackCString-35-" class="def">unpackCString#</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/ghc-prim-0.5.0.0/GHC-Prim.html#t:Addr-35-">Addr#</a> -&gt; <a href="Data-Text.html#t:Text">Text</a> <a href="src/Data-Text-Show.html#unpackCString%23" class="link">Source</a> <a href="#v:unpackCString-35-" class="selflink">#</a></p><div class="doc"><p><em>O(n)</em> Convert a literal string into a <code><a href="Data-Text.html#t:Text">Text</a></code>.  Subject to
 fusion.</p><p>This is exposed solely for people writing GHC rewrite rules.</p></div></div><h1>Orphan instances</h1><div id="section.orphans" class="show"><table><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:o:ic:IsList:IsList:1" class="instance expander" onclick="toggleSection('i:o:ic:IsList:IsList:1')"></span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/GHC-Exts.html#t:IsList">IsList</a> <a href="Data-Text.html#t:Text">Text</a></span> <a href="src/Data-Text.html#line-357" class="link">Source</a> <a href="#v:-36-fIsListText" class="selflink">#</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><div id="section.i:o:ic:IsList:IsList:1" class="inst-details hide"><div class="subs associated-types"><p class="caption">Associated Types</p><p class="src"><span class="keyword">type</span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/GHC-Exts.html#t:Item">Item</a> <a href="Data-Text.html#t:Text">Text</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Kind.html#t:-42-">*</a> <a href="#t:Item" class="selflink">#</a></p></div> <div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:fromList">fromList</a> :: [<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/GHC-Exts.html#t:Item">Item</a> <a href="Data-Text.html#t:Text">Text</a>] -&gt; <a href="Data-Text.html#t:Text">Text</a> <a href="#v:fromList" class="selflink">#</a></p><p class="src"><a href="#v:fromListN">fromListN</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Int.html#t:Int">Int</a> -&gt; [<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/GHC-Exts.html#t:Item">Item</a> <a href="Data-Text.html#t:Text">Text</a>] -&gt; <a href="Data-Text.html#t:Text">Text</a> <a href="#v:fromListN" class="selflink">#</a></p><p class="src"><a href="#v:toList">toList</a> :: <a href="Data-Text.html#t:Text">Text</a> -&gt; [<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/GHC-Exts.html#t:Item">Item</a> <a href="Data-Text.html#t:Text">Text</a>] <a href="#v:toList" class="selflink">#</a></p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:o:ic:Eq:Eq:2" class="instance expander" onclick="toggleSection('i:o:ic:Eq:Eq:2')"></span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Eq.html#t:Eq">Eq</a> <a href="Data-Text.html#t:Text">Text</a></span> <a href="src/Data-Text.html#line-324" class="link">Source</a> <a href="#v:-36-fEqText" class="selflink">#</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><div id="section.i:o:ic:Eq:Eq:2" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:-61--61-">(==)</a> :: <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a> <a href="#v:-61--61-" class="selflink">#</a></p><p class="src"><a href="#v:-47--61-">(/=)</a> :: <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a> <a href="#v:-47--61-" class="selflink">#</a></p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:o:ic:Data:Data:3" class="instance expander" onclick="toggleSection('i:o:ic:Data:Data:3')"></span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Data.html#t:Data">Data</a> <a href="Data-Text.html#t:Text">Text</a></span> <a href="src/Data-Text.html#line-390" class="link">Source</a> <a href="#v:-36-fDataText" class="selflink">#</a></td><td class="doc"><p>This instance preserves data abstraction at the cost of inefficiency.
 We omit reflection services for the sake of data abstraction.</p><p>This instance was created by copying the updated behavior of
 <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/containers-0.5.7.1/Data-Set.html">Data.Set</a>.</code><code><a href="file:///usr/share/doc/ghc-doc/html/libraries/containers-0.5.7.1/Data-Set.html#v:Set">Set</a></code> and <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/containers-0.5.7.1/Data-Map.html">Data.Map</a>.</code><code><a href="file:///usr/share/doc/ghc-doc/html/libraries/containers-0.5.7.1/Data-Map.html#v:Map">Map</a></code>. If you
 feel a mistake has been made, please feel free to submit
 improvements.</p><p>The original discussion is archived here:
 <a href="http://groups.google.com/group/haskell-cafe/browse_thread/thread/b5bbb1b28a7e525d/0639d46852575b93">could we get a Data instance for Data.Text.Text?</a></p><p>The followup discussion that changed the behavior of <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/containers-0.5.7.1/Data-Set.html#v:Set">Set</a></code>
 and <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/containers-0.5.7.1/Data-Map.html#v:Map">Map</a></code> is archived here:
 <a href="http://markmail.org/message/trovdc6zkphyi3cr#query:+page:1+mid:a46der3iacwjcf6n+state:results">Proposal: Allow gunfold for Data.Map, ...</a></p></td></tr><tr><td colspan="2"><div id="section.i:o:ic:Data:Data:3" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:gfoldl">gfoldl</a> :: (<span class="keyword">forall</span> d b. <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Data.html#t:Data">Data</a> d =&gt; c (d -&gt; b) -&gt; d -&gt; c b) -&gt; (<span class="keyword">forall</span> g. g -&gt; c g) -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; c <a href="Data-Text.html#t:Text">Text</a> <a href="#v:gfoldl" class="selflink">#</a></p><p class="src"><a href="#v:gunfold">gunfold</a> :: (<span class="keyword">forall</span> b r. <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Data.html#t:Data">Data</a> b =&gt; c (b -&gt; r) -&gt; c r) -&gt; (<span class="keyword">forall</span> r. r -&gt; c r) -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Data.html#t:Constr">Constr</a> -&gt; c <a href="Data-Text.html#t:Text">Text</a> <a href="#v:gunfold" class="selflink">#</a></p><p class="src"><a href="#v:toConstr">toConstr</a> :: <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Data.html#t:Constr">Constr</a> <a href="#v:toConstr" class="selflink">#</a></p><p class="src"><a href="#v:dataTypeOf">dataTypeOf</a> :: <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Data.html#t:DataType">DataType</a> <a href="#v:dataTypeOf" class="selflink">#</a></p><p class="src"><a href="#v:dataCast1">dataCast1</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Typeable-Internal.html#t:Typeable">Typeable</a> (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Kind.html#t:-42-">*</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Kind.html#t:-42-">*</a>) t =&gt; (<span class="keyword">forall</span> d. <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Data.html#t:Data">Data</a> d =&gt; c (t d)) -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Maybe.html#t:Maybe">Maybe</a> (c <a href="Data-Text.html#t:Text">Text</a>) <a href="#v:dataCast1" class="selflink">#</a></p><p class="src"><a href="#v:dataCast2">dataCast2</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Typeable-Internal.html#t:Typeable">Typeable</a> (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Kind.html#t:-42-">*</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Kind.html#t:-42-">*</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Kind.html#t:-42-">*</a>) t =&gt; (<span class="keyword">forall</span> d e. (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Data.html#t:Data">Data</a> d, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Data.html#t:Data">Data</a> e) =&gt; c (t d e)) -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Maybe.html#t:Maybe">Maybe</a> (c <a href="Data-Text.html#t:Text">Text</a>) <a href="#v:dataCast2" class="selflink">#</a></p><p class="src"><a href="#v:gmapT">gmapT</a> :: (<span class="keyword">forall</span> b. <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Data.html#t:Data">Data</a> b =&gt; b -&gt; b) -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a> <a href="#v:gmapT" class="selflink">#</a></p><p class="src"><a href="#v:gmapQl">gmapQl</a> :: (r -&gt; r' -&gt; r) -&gt; r -&gt; (<span class="keyword">forall</span> d. <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Data.html#t:Data">Data</a> d =&gt; d -&gt; r') -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; r <a href="#v:gmapQl" class="selflink">#</a></p><p class="src"><a href="#v:gmapQr">gmapQr</a> :: (r' -&gt; r -&gt; r) -&gt; r -&gt; (<span class="keyword">forall</span> d. <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Data.html#t:Data">Data</a> d =&gt; d -&gt; r') -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; r <a href="#v:gmapQr" class="selflink">#</a></p><p class="src"><a href="#v:gmapQ">gmapQ</a> :: (<span class="keyword">forall</span> d. <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Data.html#t:Data">Data</a> d =&gt; d -&gt; u) -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; [u] <a href="#v:gmapQ" class="selflink">#</a></p><p class="src"><a href="#v:gmapQi">gmapQi</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Int.html#t:Int">Int</a> -&gt; (<span class="keyword">forall</span> d. <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Data.html#t:Data">Data</a> d =&gt; d -&gt; u) -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; u <a href="#v:gmapQi" class="selflink">#</a></p><p class="src"><a href="#v:gmapM">gmapM</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m =&gt; (<span class="keyword">forall</span> d. <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Data.html#t:Data">Data</a> d =&gt; d -&gt; m d) -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; m <a href="Data-Text.html#t:Text">Text</a> <a href="#v:gmapM" class="selflink">#</a></p><p class="src"><a href="#v:gmapMp">gmapMp</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:MonadPlus">MonadPlus</a> m =&gt; (<span class="keyword">forall</span> d. <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Data.html#t:Data">Data</a> d =&gt; d -&gt; m d) -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; m <a href="Data-Text.html#t:Text">Text</a> <a href="#v:gmapMp" class="selflink">#</a></p><p class="src"><a href="#v:gmapMo">gmapMo</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:MonadPlus">MonadPlus</a> m =&gt; (<span class="keyword">forall</span> d. <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Data.html#t:Data">Data</a> d =&gt; d -&gt; m d) -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; m <a href="Data-Text.html#t:Text">Text</a> <a href="#v:gmapMo" class="selflink">#</a></p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:o:ic:Ord:Ord:4" class="instance expander" onclick="toggleSection('i:o:ic:Ord:Ord:4')"></span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Ord.html#t:Ord">Ord</a> <a href="Data-Text.html#t:Text">Text</a></span> <a href="src/Data-Text.html#line-330" class="link">Source</a> <a href="#v:-36-fOrdText" class="selflink">#</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><div id="section.i:o:ic:Ord:Ord:4" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:compare">compare</a> :: <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Ord.html#t:Ordering">Ordering</a> <a href="#v:compare" class="selflink">#</a></p><p class="src"><a href="#v:-60-">(&lt;)</a> :: <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a> <a href="#v:-60-" class="selflink">#</a></p><p class="src"><a href="#v:-60--61-">(&lt;=)</a> :: <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a> <a href="#v:-60--61-" class="selflink">#</a></p><p class="src"><a href="#v:-62-">(&gt;)</a> :: <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a> <a href="#v:-62-" class="selflink">#</a></p><p class="src"><a href="#v:-62--61-">(&gt;=)</a> :: <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a> <a href="#v:-62--61-" class="selflink">#</a></p><p class="src"><a href="#v:max">max</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="#v:max" class="selflink">#</a></p><p class="src"><a href="#v:min">min</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="#v:min" class="selflink">#</a></p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:o:ic:Read:Read:5" class="instance expander" onclick="toggleSection('i:o:ic:Read:Read:5')"></span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Text-Read.html#t:Read">Read</a> <a href="Data-Text.html#t:Text">Text</a></span> <a href="src/Data-Text.html#line-333" class="link">Source</a> <a href="#v:-36-fReadText" class="selflink">#</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><div id="section.i:o:ic:Read:Read:5" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:readsPrec">readsPrec</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Int.html#t:Int">Int</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Text-ParserCombinators-ReadP.html#t:ReadS">ReadS</a> <a href="Data-Text.html#t:Text">Text</a> <a href="#v:readsPrec" class="selflink">#</a></p><p class="src"><a href="#v:readList">readList</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Text-ParserCombinators-ReadP.html#t:ReadS">ReadS</a> [<a href="Data-Text.html#t:Text">Text</a>] <a href="#v:readList" class="selflink">#</a></p><p class="src"><a href="#v:readPrec">readPrec</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Text-ParserCombinators-ReadPrec.html#t:ReadPrec">ReadPrec</a> <a href="Data-Text.html#t:Text">Text</a> <a href="#v:readPrec" class="selflink">#</a></p><p class="src"><a href="#v:readListPrec">readListPrec</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Text-ParserCombinators-ReadPrec.html#t:ReadPrec">ReadPrec</a> [<a href="Data-Text.html#t:Text">Text</a>] <a href="#v:readListPrec" class="selflink">#</a></p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:o:ic:IsString:IsString:6" class="instance expander" onclick="toggleSection('i:o:ic:IsString:IsString:6')"></span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-String.html#t:IsString">IsString</a> <a href="Data-Text.html#t:Text">Text</a></span> <a href="src/Data-Text.html#line-353" class="link">Source</a> <a href="#v:-36-fIsStringText" class="selflink">#</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><div id="section.i:o:ic:IsString:IsString:6" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:fromString">fromString</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-String.html#t:String">String</a> -&gt; <a href="Data-Text.html#t:Text">Text</a> <a href="#v:fromString" class="selflink">#</a></p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:o:ic:Semigroup:Semigroup:7" class="instance expander" onclick="toggleSection('i:o:ic:Semigroup:Semigroup:7')"></span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Semigroup.html#t:Semigroup">Semigroup</a> <a href="Data-Text.html#t:Text">Text</a></span> <a href="src/Data-Text.html#line-340" class="link">Source</a> <a href="#v:-36-fSemigroupText" class="selflink">#</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><div id="section.i:o:ic:Semigroup:Semigroup:7" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:-60--62-">(&lt;&gt;)</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="#v:-60--62-" class="selflink">#</a></p><p class="src"><a href="#v:sconcat">sconcat</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a> <a href="#v:sconcat" class="selflink">#</a></p><p class="src"><a href="#v:stimes">stimes</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Prelude.html#t:Integral">Integral</a> b =&gt; b -&gt; <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="Data-Text.html#t:Text">Text</a> <a href="#v:stimes" class="selflink">#</a></p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:o:ic:Monoid:Monoid:8" class="instance expander" onclick="toggleSection('i:o:ic:Monoid:Monoid:8')"></span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Monoid.html#t:Monoid">Monoid</a> <a href="Data-Text.html#t:Text">Text</a></span> <a href="src/Data-Text.html#line-344" class="link">Source</a> <a href="#v:-36-fMonoidText" class="selflink">#</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><div id="section.i:o:ic:Monoid:Monoid:8" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:mempty">mempty</a> :: <a href="Data-Text.html#t:Text">Text</a> <a href="#v:mempty" class="selflink">#</a></p><p class="src"><a href="#v:mappend">mappend</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="#v:mappend" class="selflink">#</a></p><p class="src"><a href="#v:mconcat">mconcat</a> :: [<a href="Data-Text.html#t:Text">Text</a>] -&gt; <a href="Data-Text.html#t:Text">Text</a> <a href="#v:mconcat" class="selflink">#</a></p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:o:ic:PrintfArg:PrintfArg:9" class="instance expander" onclick="toggleSection('i:o:ic:PrintfArg:PrintfArg:9')"></span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Text-Printf.html#t:PrintfArg">PrintfArg</a> <a href="Data-Text.html#t:Text">Text</a></span> <a href="src/Data-Text.html#line-400" class="link">Source</a> <a href="#v:-36-fPrintfArgText" class="selflink">#</a></td><td class="doc"><p>Only defined for <code>base-4.7.0.0</code> and later</p></td></tr><tr><td colspan="2"><div id="section.i:o:ic:PrintfArg:PrintfArg:9" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:formatArg">formatArg</a> :: <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Text-Printf.html#t:FieldFormatter">FieldFormatter</a> <a href="#v:formatArg" class="selflink">#</a></p><p class="src"><a href="#v:parseFormat">parseFormat</a> :: <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Text-Printf.html#t:ModifierParser">ModifierParser</a> <a href="#v:parseFormat" class="selflink">#</a></p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:o:ic:Binary:Binary:10" class="instance expander" onclick="toggleSection('i:o:ic:Binary:Binary:10')"></span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/binary-0.8.3.0/Data-Binary.html#t:Binary">Binary</a> <a href="Data-Text.html#t:Text">Text</a></span> <a href="src/Data-Text.html#line-367" class="link">Source</a> <a href="#v:-36-fBinaryText" class="selflink">#</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><div id="section.i:o:ic:Binary:Binary:10" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:put">put</a> :: <a href="Data-Text.html#t:Text">Text</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/binary-0.8.3.0/Data-Binary-Put.html#t:Put">Put</a> <a href="#v:put" class="selflink">#</a></p><p class="src"><a href="#v:get">get</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/binary-0.8.3.0/Data-Binary-Get-Internal.html#t:Get">Get</a> <a href="Data-Text.html#t:Text">Text</a> <a href="#v:get" class="selflink">#</a></p><p class="src"><a href="#v:putList">putList</a> :: [<a href="Data-Text.html#t:Text">Text</a>] -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/binary-0.8.3.0/Data-Binary-Put.html#t:Put">Put</a> <a href="#v:putList" class="selflink">#</a></p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:o:ic:NFData:NFData:11" class="instance expander" onclick="toggleSection('i:o:ic:NFData:NFData:11')"></span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/deepseq-1.4.2.0/Control-DeepSeq.html#t:NFData">NFData</a> <a href="Data-Text.html#t:Text">Text</a></span> <a href="src/Data-Text.html#line-364" class="link">Source</a> <a href="#v:-36-fNFDataText" class="selflink">#</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><div id="section.i:o:ic:NFData:NFData:11" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:rnf">rnf</a> :: <a href="Data-Text.html#t:Text">Text</a> -&gt; () <a href="#v:rnf" class="selflink">#</a></p></div></div></td></tr></table></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.17.3</p></div></body></html>