/usr/share/doc/libghc-text-doc/html/Data-Text-Lazy.html is in libghc-text-doc 1.2.2.1-3.
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 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Data.Text.Lazy</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script 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-Lazy.html");};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="src/Data-Text-Lazy.html">Source</a></li><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">text-1.2.2.1: An efficient packed Unicode text type.</p></div><div id="content"><div id="module-header"><table class="info"><tr><th>Copyright</th><td>(c) 2009, 2010, 2012 Bryan O'Sullivan</td></tr><tr><th>License</th><td>BSD-style</td></tr><tr><th>Maintainer</th><td>bos@serpentine.com</td></tr><tr><th>Stability</th><td>experimental</td></tr><tr><th>Portability</th><td>GHC</td></tr><tr><th>Safe Haskell</th><td>Trustworthy</td></tr><tr><th>Language</th><td>Haskell98</td></tr></table><p class="caption">Data.Text.Lazy</p></div><div id="table-of-contents"><p class="caption">Contents</p><ul><li><a href="#g:1">Fusion</a></li><li><a href="#g:2">Acceptable data</a></li><li><a href="#g:3">Types</a></li><li><a href="#g:4">Creation and elimination</a></li><li><a href="#g:5">Basic interface</a></li><li><a href="#g:6">Transformations</a><ul><li><a href="#g:7">Case conversion</a></li><li><a href="#g:8">Justification</a></li></ul></li><li><a href="#g:9">Folds</a><ul><li><a href="#g:10">Special folds</a></li></ul></li><li><a href="#g:11">Construction</a><ul><li><a href="#g:12">Scans</a></li><li><a href="#g:13">Accumulating maps</a></li><li><a href="#g:14">Generation and unfolding</a></li></ul></li><li><a href="#g:15">Substrings</a><ul><li><a href="#g:16">Breaking strings</a></li><li><a href="#g:17">Breaking into many substrings</a></li><li><a href="#g:18">Breaking into lines and words</a></li></ul></li><li><a href="#g:19">Predicates</a><ul><li><a href="#g:20">View patterns</a></li></ul></li><li><a href="#g:21">Searching</a></li><li><a href="#g:22">Indexing</a></li><li><a href="#g:23">Zipping and unzipping</a></li><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 using
lists of packed arrays.</p><p><em>Note</em>: Read below the synopsis for important notes on the use of
this module.</p><p>The representation used by this module is suitable for high
performance use and for streaming large quantities of data. It
provides a means to manipulate a large body of text without
requiring that the entire content be resident in memory.</p><p>Some operations, such as <code><a href="Data-Text-Lazy.html#v:concat">concat</a></code>, <code><a href="Data-Text-Lazy.html#v:append">append</a></code>, <code><a href="Data-Text-Lazy.html#v:reverse">reverse</a></code> and <code><a href="Data-Text-Lazy.html#v:cons">cons</a></code>,
have better time complexity than their <a href="Data-Text.html">Data.Text</a> equivalents, due
to the underlying representation being a list of chunks. For other
operations, lazy <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code>s are usually within a few percent of strict
ones, but often with better heap usage if used in a streaming
fashion. For data larger than available memory, or if you have
tight memory constraints, this module will be the only option.</p><p>This module is intended to be imported <code>qualified</code>, to avoid name
clashes with <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Prelude.html">Prelude</a> functions. eg.</p><pre>import qualified Data.Text.Lazy as L</pre></div></div><div id="synopsis"><p id="control.syn" class="caption expander" onclick="toggleSection('syn')">Synopsis</p><ul id="section.syn" class="hide" onclick="toggleSection('syn')"><li class="src short"><span class="keyword">data</span> <a href="#t:Text">Text</a></li><li class="src short"><a href="#v:pack">pack</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-String.html#t:String">String</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:unpack">unpack</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.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.0.0/Data-Char.html#t:Char">Char</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:empty">empty</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:fromChunks">fromChunks</a> :: [<a href="Data-Text.html#t:Text">Text</a>] -> <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:toChunks">toChunks</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -> [<a href="Data-Text.html#t:Text">Text</a>]</li><li class="src short"><a href="#v:toStrict">toStrict</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text.html#t:Text">Text</a></li><li class="src short"><a href="#v:fromStrict">fromStrict</a> :: <a href="Data-Text.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:foldrChunks">foldrChunks</a> :: (<a href="Data-Text.html#t:Text">Text</a> -> a -> a) -> a -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> a</li><li class="src short"><a href="#v:foldlChunks">foldlChunks</a> :: (a -> <a href="Data-Text.html#t:Text">Text</a> -> a) -> a -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> 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.0.0/Data-Char.html#t:Char">Char</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:snoc">snoc</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:append">append</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:uncons">uncons</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Maybe.html#t:Maybe">Maybe</a> (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a>, <a href="Data-Text-Lazy.html#t:Text">Text</a>)</li><li class="src short"><a href="#v:head">head</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a></li><li class="src short"><a href="#v:last">last</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a></li><li class="src short"><a href="#v:tail">tail</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:init">init</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:null">null</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><a href="#v:length">length</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Int.html#t:Int64">Int64</a></li><li class="src short"><a href="#v:compareLength">compareLength</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Int.html#t:Int64">Int64</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.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.0.0/Data-Char.html#t:Char">Char</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a>) -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:intercalate">intercalate</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -> [<a href="Data-Text-Lazy.html#t:Text">Text</a>] -> <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:intersperse">intersperse</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:transpose">transpose</a> :: [<a href="Data-Text-Lazy.html#t:Text">Text</a>] -> [<a href="Data-Text-Lazy.html#t:Text">Text</a>]</li><li class="src short"><a href="#v:reverse">reverse</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:replace">replace</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:toCaseFold">toCaseFold</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:toLower">toLower</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:toUpper">toUpper</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:toTitle">toTitle</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:justifyLeft">justifyLeft</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Int.html#t:Int64">Int64</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:justifyRight">justifyRight</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Int.html#t:Int64">Int64</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:center">center</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Int.html#t:Int64">Int64</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:foldl">foldl</a> :: (a -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a> -> a) -> a -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> a</li><li class="src short"><a href="#v:foldl-39-">foldl'</a> :: (a -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a> -> a) -> a -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> 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.0.0/Data-Char.html#t:Char">Char</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a>) -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.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.0.0/Data-Char.html#t:Char">Char</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a>) -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.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.0.0/Data-Char.html#t:Char">Char</a> -> a -> a) -> a -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> 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.0.0/Data-Char.html#t:Char">Char</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a>) -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a></li><li class="src short"><a href="#v:concat">concat</a> :: [<a href="Data-Text-Lazy.html#t:Text">Text</a>] -> <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:concatMap">concatMap</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a>) -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:any">any</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.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.0.0/Data-Char.html#t:Char">Char</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><a href="#v:maximum">maximum</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a></li><li class="src short"><a href="#v:minimum">minimum</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.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.0.0/Data-Char.html#t:Char">Char</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a>) -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:scanl1">scanl1</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a>) -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:scanr">scanr</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a>) -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:scanr1">scanr1</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a>) -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:mapAccumL">mapAccumL</a> :: (a -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a> -> (a, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a>)) -> a -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> (a, <a href="Data-Text-Lazy.html#t:Text">Text</a>)</li><li class="src short"><a href="#v:mapAccumR">mapAccumR</a> :: (a -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a> -> (a, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a>)) -> a -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> (a, <a href="Data-Text-Lazy.html#t:Text">Text</a>)</li><li class="src short"><a href="#v:repeat">repeat</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:replicate">replicate</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Int.html#t:Int64">Int64</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:cycle">cycle</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:iterate">iterate</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a>) -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:unfoldr">unfoldr</a> :: (a -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Maybe.html#t:Maybe">Maybe</a> (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a>, a)) -> a -> <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:unfoldrN">unfoldrN</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Int.html#t:Int64">Int64</a> -> (a -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Maybe.html#t:Maybe">Maybe</a> (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a>, a)) -> a -> <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:take">take</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Int.html#t:Int64">Int64</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:takeEnd">takeEnd</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Int.html#t:Int64">Int64</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:drop">drop</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Int.html#t:Int64">Int64</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:dropEnd">dropEnd</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Int.html#t:Int64">Int64</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:takeWhile">takeWhile</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:takeWhileEnd">takeWhileEnd</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:dropWhile">dropWhile</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:dropWhileEnd">dropWhileEnd</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:dropAround">dropAround</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:strip">strip</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:stripStart">stripStart</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:stripEnd">stripEnd</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:splitAt">splitAt</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Int.html#t:Int64">Int64</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> (<a href="Data-Text-Lazy.html#t:Text">Text</a>, <a href="Data-Text-Lazy.html#t:Text">Text</a>)</li><li class="src short"><a href="#v:span">span</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> (<a href="Data-Text-Lazy.html#t:Text">Text</a>, <a href="Data-Text-Lazy.html#t:Text">Text</a>)</li><li class="src short"><a href="#v:breakOn">breakOn</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> (<a href="Data-Text-Lazy.html#t:Text">Text</a>, <a href="Data-Text-Lazy.html#t:Text">Text</a>)</li><li class="src short"><a href="#v:breakOnEnd">breakOnEnd</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> (<a href="Data-Text-Lazy.html#t:Text">Text</a>, <a href="Data-Text-Lazy.html#t:Text">Text</a>)</li><li class="src short"><a href="#v:break">break</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> (<a href="Data-Text-Lazy.html#t:Text">Text</a>, <a href="Data-Text-Lazy.html#t:Text">Text</a>)</li><li class="src short"><a href="#v:group">group</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -> [<a href="Data-Text-Lazy.html#t:Text">Text</a>]</li><li class="src short"><a href="#v:groupBy">groupBy</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> [<a href="Data-Text-Lazy.html#t:Text">Text</a>]</li><li class="src short"><a href="#v:inits">inits</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -> [<a href="Data-Text-Lazy.html#t:Text">Text</a>]</li><li class="src short"><a href="#v:tails">tails</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -> [<a href="Data-Text-Lazy.html#t:Text">Text</a>]</li><li class="src short"><a href="#v:splitOn">splitOn</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> [<a href="Data-Text-Lazy.html#t:Text">Text</a>]</li><li class="src short"><a href="#v:split">split</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> [<a href="Data-Text-Lazy.html#t:Text">Text</a>]</li><li class="src short"><a href="#v:chunksOf">chunksOf</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Int.html#t:Int64">Int64</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> [<a href="Data-Text-Lazy.html#t:Text">Text</a>]</li><li class="src short"><a href="#v:lines">lines</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -> [<a href="Data-Text-Lazy.html#t:Text">Text</a>]</li><li class="src short"><a href="#v:words">words</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -> [<a href="Data-Text-Lazy.html#t:Text">Text</a>]</li><li class="src short"><a href="#v:unlines">unlines</a> :: [<a href="Data-Text-Lazy.html#t:Text">Text</a>] -> <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:unwords">unwords</a> :: [<a href="Data-Text-Lazy.html#t:Text">Text</a>] -> <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:isPrefixOf">isPrefixOf</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><a href="#v:isSuffixOf">isSuffixOf</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><a href="#v:isInfixOf">isInfixOf</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><a href="#v:stripPrefix">stripPrefix</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:stripSuffix">stripSuffix</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:commonPrefixes">commonPrefixes</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Maybe.html#t:Maybe">Maybe</a> (<a href="Data-Text-Lazy.html#t:Text">Text</a>, <a href="Data-Text-Lazy.html#t:Text">Text</a>, <a href="Data-Text-Lazy.html#t:Text">Text</a>)</li><li class="src short"><a href="#v:filter">filter</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a></li><li class="src short"><a href="#v:find">find</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a></li><li class="src short"><a href="#v:breakOnAll">breakOnAll</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> [(<a href="Data-Text-Lazy.html#t:Text">Text</a>, <a href="Data-Text-Lazy.html#t:Text">Text</a>)]</li><li class="src short"><a href="#v:partition">partition</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> (<a href="Data-Text-Lazy.html#t:Text">Text</a>, <a href="Data-Text-Lazy.html#t:Text">Text</a>)</li><li class="src short"><a href="#v:index">index</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Int.html#t:Int64">Int64</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a></li><li class="src short"><a href="#v:count">count</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Int.html#t:Int64">Int64</a></li><li class="src short"><a href="#v:zip">zip</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> [(<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a>, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.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.0.0/Data-Char.html#t:Char">Char</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a>) -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a></li></ul></div><div id="interface"><h1 id="g:1">Fusion</h1><div class="doc"><p>Most of the functions in this module are subject to <em>fusion</em>,
meaning that a pipeline of such functions will usually allocate at
most one <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code> value.</p><p>As an example, consider the following pipeline:</p><pre>import Data.Text.Lazy as T
import Data.Text.Lazy.Encoding as E
import Data.ByteString.Lazy (ByteString)
countChars :: ByteString -> Int
countChars = T.length . T.toUpper . E.decodeUtf8</pre><p>From the type signatures involved, this looks like it should
allocate one <code>ByteString</code> value, and two <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code> values. However,
when a module is compiled with optimisation enabled under GHC, the
two intermediate <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code> values will be optimised away, and the
function will be compiled down to a single loop over the source
<code>ByteString</code>.</p><p>Functions that can be fused by the compiler are documented with the
phrase "Subject to fusion".</p></div><h1 id="g:2">Acceptable data</h1><div class="doc"><p>A <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code> value is a sequence of Unicode scalar values, as defined
in §3.9, definition D76 of the Unicode 5.2 standard:
<a href="http://www.unicode.org/versions/Unicode5.2.0/ch03.pdf#page=35">http://www.unicode.org/versions/Unicode5.2.0/ch03.pdf#page=35</a>. As
such, a <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code> cannot contain values in the range U+D800 to U+DFFF
inclusive. Haskell implementations admit all Unicode code points
(§3.4, definition D10) as <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a></code> values, including code points
from this invalid range. This means that there are some <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a></code>
values that are not valid Unicode scalar values, and the functions
in this module must handle those cases.</p><p>Within this module, many functions construct a <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code> from one or
more <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.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.0.0/Data-Char.html#t:Char">Char</a></code> values
that are not valid Unicode scalar values with the replacement
character "�" (U+FFFD). Functions that perform this
inspection and replacement are documented with the phrase
"Performs replacement on invalid scalar values".</p><p>(One reason for this policy of replacement is that internally, a
<code><a href="Data-Text-Lazy.html#t:Text">Text</a></code> value is represented as packed UTF-16 data. Values in the
range U+D800 through U+DFFF are used by UTF-16 to denote surrogate
code points, and so cannot be represented. The functions replace
invalid scalar values, instead of dropping them, as a security
measure. For details, see Unicode Technical Report 36, §3.5:
<a href="http://unicode.org/reports/tr36#Deletion_of_Noncharacters">http://unicode.org/reports/tr36#Deletion_of_Noncharacters</a>)</p></div><h1 id="g:3">Types</h1><div class="top"><p class="src"><span class="keyword">data</span> <a id="t:Text" class="def">Text</a> <a href="src/Data-Text-Internal-Lazy.html#Text" class="link">Source</a> <a href="#t:Text" class="selflink">#</a></p><div class="subs instances"><p id="control.i:Text" class="caption collapser" onclick="toggleSection('i:Text')">Instances</p><div id="section.i:Text" class="show"><table><tr><td class="src clearfix"><span class="inst-left"><span 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.0.0/GHC-Exts.html#t:Item">Item</a> <a href="Data-Text-Lazy.html#t:Text">Text</a></span> <a href="#t:Item" class="selflink">#</a></td><td class="doc empty"> </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.0.0/GHC-Exts.html#t:Item">Item</a> <a href="Data-Text-Lazy.html#t:Text">Text</a> = <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a></div></div></td></tr></table></div></div></div><h1 id="g:4">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.0.0/Data-String.html#t:String">String</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Lazy.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.0.0/Data-String.html#t:String">String</a></code> into a <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code>.</p><p>Subject to fusion. Performs replacement on invalid scalar values.</p></div></div><div class="top"><p class="src"><a id="v:unpack" class="def">unpack</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-String.html#t:String">String</a> <a href="src/Data-Text-Lazy.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-Lazy.html#t:Text">Text</a></code> into a <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.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.0.0/Data-Char.html#t:Char">Char</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Lazy.html#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-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Internal-Lazy.html#empty" class="link">Source</a> <a href="#v:empty" class="selflink">#</a></p><div class="doc"><p>Smart constructor for <code><a href="Data-Text-Internal-Lazy.html#v:Empty">Empty</a></code>.</p></div></div><div class="top"><p class="src"><a id="v:fromChunks" class="def">fromChunks</a> :: [<a href="Data-Text.html#t:Text">Text</a>] -> <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Lazy.html#fromChunks" class="link">Source</a> <a href="#v:fromChunks" class="selflink">#</a></p><div class="doc"><p><em>O(c)</em> Convert a list of strict <code><a href="Data-Text.html#t:Text">Text</a></code>s into a lazy <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code>.</p></div></div><div class="top"><p class="src"><a id="v:toChunks" class="def">toChunks</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -> [<a href="Data-Text.html#t:Text">Text</a>] <a href="src/Data-Text-Lazy.html#toChunks" class="link">Source</a> <a href="#v:toChunks" class="selflink">#</a></p><div class="doc"><p><em>O(n)</em> Convert a lazy <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code> into a list of strict <code><a href="Data-Text.html#t:Text">Text</a></code>s.</p></div></div><div class="top"><p class="src"><a id="v:toStrict" class="def">toStrict</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text.html#t:Text">Text</a> <a href="src/Data-Text-Lazy.html#toStrict" class="link">Source</a> <a href="#v:toStrict" class="selflink">#</a></p><div class="doc"><p><em>O(n)</em> Convert a lazy <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code> into a strict <code><a href="Data-Text.html#t:Text">Text</a></code>.</p></div></div><div class="top"><p class="src"><a id="v:fromStrict" class="def">fromStrict</a> :: <a href="Data-Text.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Lazy.html#fromStrict" class="link">Source</a> <a href="#v:fromStrict" class="selflink">#</a></p><div class="doc"><p><em>O(c)</em> Convert a strict <code><a href="Data-Text.html#t:Text">Text</a></code> into a lazy <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code>.</p></div></div><div class="top"><p class="src"><a id="v:foldrChunks" class="def">foldrChunks</a> :: (<a href="Data-Text.html#t:Text">Text</a> -> a -> a) -> a -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> a <a href="src/Data-Text-Internal-Lazy.html#foldrChunks" class="link">Source</a> <a href="#v:foldrChunks" class="selflink">#</a></p><div class="doc"><p>Consume the chunks of a lazy <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code> with a natural right fold.</p></div></div><div class="top"><p class="src"><a id="v:foldlChunks" class="def">foldlChunks</a> :: (a -> <a href="Data-Text.html#t:Text">Text</a> -> a) -> a -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> a <a href="src/Data-Text-Internal-Lazy.html#foldlChunks" class="link">Source</a> <a href="#v:foldlChunks" class="selflink">#</a></p><div class="doc"><p>Consume the chunks of a lazy <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code> with a strict, tail-recursive,
accumulating left fold.</p></div></div><h1 id="g:5">Basic interface</h1><div class="top"><p class="src"><a id="v:cons" class="def">cons</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> <span class="fixity">infixr 5</span><span class="rightedge"></span> <a href="src/Data-Text-Lazy.html#cons" class="link">Source</a> <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-Lazy.html#t:Text">Text</a></code>. This function
is more costly than its <code>List</code> counterpart because it requires
copying a new array. Subject to fusion.</p></div></div><div class="top"><p class="src"><a id="v:snoc" class="def">snoc</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Lazy.html#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-Lazy.html#t:Text">Text</a></code>. This copies the
entire array in the process, unless fused. Subject to fusion.</p></div></div><div class="top"><p class="src"><a id="v:append" class="def">append</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Lazy.html#append" class="link">Source</a> <a href="#v:append" class="selflink">#</a></p><div class="doc"><p><em>O(n/c)</em> Appends one <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code> to another. Subject to fusion.</p></div></div><div class="top"><p class="src"><a id="v:uncons" class="def">uncons</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Maybe.html#t:Maybe">Maybe</a> (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a>, <a href="Data-Text-Lazy.html#t:Text">Text</a>) <a href="src/Data-Text-Lazy.html#uncons" class="link">Source</a> <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-Lazy.html#t:Text">Text</a></code>, or
<code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Maybe.html#v:Nothing">Nothing</a></code> if empty. Subject to fusion.</p></div></div><div class="top"><p class="src"><a id="v:head" class="def">head</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a> <a href="src/Data-Text-Lazy.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-Lazy.html#t:Text">Text</a></code>, which must be
non-empty. Subject to fusion.</p></div></div><div class="top"><p class="src"><a id="v:last" class="def">last</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a> <a href="src/Data-Text-Lazy.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-Lazy.html#t:Text">Text</a></code>, which must be
non-empty. Subject to fusion.</p></div></div><div class="top"><p class="src"><a id="v:tail" class="def">tail</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Lazy.html#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-Lazy.html#t:Text">Text</a></code>, which
must be non-empty. Subject to fusion.</p></div></div><div class="top"><p class="src"><a id="v:init" class="def">init</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Lazy.html#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-Lazy.html#t:Text">Text</a></code>, which must
be non-empty. Subject to fusion.</p></div></div><div class="top"><p class="src"><a id="v:null" class="def">null</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Bool.html#t:Bool">Bool</a> <a href="src/Data-Text-Lazy.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-Lazy.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-Lazy.html#t:Text">Text</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Int.html#t:Int64">Int64</a> <a href="src/Data-Text-Lazy.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-Lazy.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-Lazy.html#t:Text">Text</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Int.html#t:Int64">Int64</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Ord.html#t:Ordering">Ordering</a> <a href="src/Data-Text-Lazy.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-Lazy.html#t:Text">Text</a></code> to a number.
Subject to fusion.</p><p>This function gives the same answer as comparing against the result
of <code><a href="Data-Text-Lazy.html#v:length">length</a></code>, but can short circuit if the count of characters is
greater than the number, and hence be more efficient.</p></div></div><h1 id="g:6">Transformations</h1><div class="top"><p class="src"><a id="v:map" class="def">map</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a>) -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Lazy.html#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-Lazy.html#v:map">map</a></code> <code>f</code> <code>t</code> is the <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code> obtained by applying <code>f</code> to
each element of <code>t</code>. Subject to fusion. Performs replacement on
invalid scalar values.</p></div></div><div class="top"><p class="src"><a id="v:intercalate" class="def">intercalate</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -> [<a href="Data-Text-Lazy.html#t:Text">Text</a>] -> <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Lazy.html#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-Lazy.html#v:intercalate">intercalate</a></code> function takes a <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code> and a list of
<code><a href="Data-Text-Lazy.html#t:Text">Text</a></code>s and concatenates the list after interspersing the first
argument between each element of the list.</p></div></div><div class="top"><p class="src"><a id="v:intersperse" class="def">intersperse</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Lazy.html#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-Lazy.html#v:intersperse">intersperse</a></code> function takes a character and places it
between the characters of a <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code>. Subject to fusion. Performs
replacement on invalid scalar values.</p></div></div><div class="top"><p class="src"><a id="v:transpose" class="def">transpose</a> :: [<a href="Data-Text-Lazy.html#t:Text">Text</a>] -> [<a href="Data-Text-Lazy.html#t:Text">Text</a>] <a href="src/Data-Text-Lazy.html#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-Lazy.html#v:transpose">transpose</a></code> function transposes the rows and columns
of its <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code> argument. Note that this function uses <code><a href="Data-Text-Lazy.html#v:pack">pack</a></code>,
<code><a href="Data-Text-Lazy.html#v:unpack">unpack</a></code>, and the list version of transpose, and is thus not very
efficient.</p></div></div><div class="top"><p class="src"><a id="v:reverse" class="def">reverse</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Lazy.html#reverse" class="link">Source</a> <a href="#v:reverse" class="selflink">#</a></p><div class="doc"><p><em>O(n)</em> <code><a href="Data-Text-Lazy.html#v:reverse">reverse</a></code> <code>t</code> returns the elements of <code>t</code> in reverse order.</p></div></div><div class="top"><p class="src"><a id="v:replace" class="def">replace</a> <a href="src/Data-Text-Lazy.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-Lazy.html#t:Text">Text</a></td><td class="doc"><p><code>needle</code> to search for. If this string is empty, an
error will occur.</p></td></tr><tr><td class="src">-> <a href="Data-Text-Lazy.html#t:Text">Text</a></td><td class="doc"><p><code>replacement</code> to replace <code>needle</code> with.</p></td></tr><tr><td class="src">-> <a href="Data-Text-Lazy.html#t:Text">Text</a></td><td class="doc"><p><code>haystack</code> in which to search.</p></td></tr><tr><td class="src">-> <a href="Data-Text-Lazy.html#t:Text">Text</a></td><td class="doc empty"> </td></tr></table></div><div class="doc"><p><em>O(m+n)</em> Replace every non-overlapping occurrence of <code>needle</code> in
<code>haystack</code> with <code>replacement</code>.</p><p>This function behaves as though it was defined as follows:</p><pre>replace needle replacement haystack =
<code><a href="Data-Text-Lazy.html#v:intercalate">intercalate</a></code> replacement (<code><a href="Data-Text-Lazy.html#v:splitOn">splitOn</a></code> needle haystack)
</pre><p>As this suggests, each occurrence is replaced exactly once. So if
<code>needle</code> occurs in <code>replacement</code>, that occurrence will <em>not</em> itself
be replaced recursively:</p><pre>replace "oo" "foo" "oo" == "foo"</pre><p>In cases where several instances of <code>needle</code> overlap, only the
first one will be replaced:</p><pre>replace "ofo" "bar" "ofofo" == "barfo"</pre><p>In (unlikely) bad cases, this function's time complexity degrades
towards <em>O(n*m)</em>.</p></div></div><h2 id="g:7">Case conversion</h2><div class="doc"><p>With Unicode text, it is incorrect to use combinators like <code>map
toUpper</code> to case convert each character of a string individually.
Instead, use the whole-string case conversion functions from this
module. For correctness in different writing systems, these
functions may map one input character to two or three output
characters.</p></div><div class="top"><p class="src"><a id="v:toCaseFold" class="def">toCaseFold</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Lazy.html#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 (or case
insensitive) string comparisons.</p><p>A string <code>x</code> is a caseless match for a string <code>y</code> if and only if:</p><pre>toCaseFold x == toCaseFold y</pre><p>The result string may be longer than the input string, and may
differ from applying <code><a href="Data-Text-Lazy.html#v:toLower">toLower</a></code> to the input string. For instance,
the Armenian small ligature men now (U+FB13) is case folded to the
bigram men now (U+0574 U+0576), while the micro sign (U+00B5) is
case folded to the Greek small letter letter mu (U+03BC) instead of
itself.</p></div></div><div class="top"><p class="src"><a id="v:toLower" class="def">toLower</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Lazy.html#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, the Latin capital letter I with dot above (U+0130) maps
to the sequence Latin small letter i (U+0069) followed by combining
dot above (U+0307).</p></div></div><div class="top"><p class="src"><a id="v:toUpper" class="def">toUpper</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Lazy.html#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 eszett (U+00DF) maps to the two-letter
sequence SS.</p></div></div><div class="top"><p class="src"><a id="v:toTitle" class="def">toTitle</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Lazy.html#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 fl (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 "The Hill of the Red
Fox" is correctly title cased—but this function will
capitalize <em>every</em> word.</p></div></div><h2 id="g:8">Justification</h2><div class="top"><p class="src"><a id="v:justifyLeft" class="def">justifyLeft</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Int.html#t:Int64">Int64</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Lazy.html#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' "foo" == "fooxxxx"
justifyLeft 3 'x' "foobar" == "foobar"</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.0.0/Data-Int.html#t:Int64">Int64</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Lazy.html#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' "bar" == "xxxxbar"
justifyRight 3 'x' "foobar" == "foobar"</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.0.0/Data-Int.html#t:Int64">Int64</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Lazy.html#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' "HS" = "xxxHSxxx"</pre></div></div><h1 id="g:9">Folds</h1><div class="top"><p class="src"><a id="v:foldl" class="def">foldl</a> :: (a -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a> -> a) -> a -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> a <a href="src/Data-Text-Lazy.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-Lazy.html#v:foldl">foldl</a></code>, applied to a binary operator, a starting value
(typically the left-identity of the operator), and a <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code>,
reduces the <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code> using the binary operator, from left to right.
Subject to fusion.</p></div></div><div class="top"><p class="src"><a id="v:foldl-39-" class="def">foldl'</a> :: (a -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a> -> a) -> a -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> a <a href="src/Data-Text-Lazy.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-Lazy.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.0.0/Data-Char.html#t:Char">Char</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a>) -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a> <a href="src/Data-Text-Lazy.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-Lazy.html#v:foldl">foldl</a></code> that has no starting value argument,
and thus must be applied to a non-empty <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code>. Subject to fusion.</p></div></div><div class="top"><p class="src"><a id="v:foldl1-39-" class="def">foldl1'</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a>) -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a> <a href="src/Data-Text-Lazy.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-Lazy.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.0.0/Data-Char.html#t:Char">Char</a> -> a -> a) -> a -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> a <a href="src/Data-Text-Lazy.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-Lazy.html#v:foldr">foldr</a></code>, applied to a binary operator, a starting value
(typically the right-identity of the operator), and a <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code>,
reduces the <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code> using the binary operator, from right to left.
Subject to fusion.</p></div></div><div class="top"><p class="src"><a id="v:foldr1" class="def">foldr1</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a>) -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a> <a href="src/Data-Text-Lazy.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-Lazy.html#v:foldr">foldr</a></code> that has no starting value argument,
and thus must be applied to a non-empty <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code>. Subject to
fusion.</p></div></div><h2 id="g:10">Special folds</h2><div class="top"><p class="src"><a id="v:concat" class="def">concat</a> :: [<a href="Data-Text-Lazy.html#t:Text">Text</a>] -> <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Lazy.html#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-Lazy.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.0.0/Data-Char.html#t:Char">Char</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a>) -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Lazy.html#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-Lazy.html#t:Text">Text</a></code> that results in a <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code>, and
concatenate the results.</p></div></div><div class="top"><p class="src"><a id="v:any" class="def">any</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Bool.html#t:Bool">Bool</a> <a href="src/Data-Text-Lazy.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-Lazy.html#v:any">any</a></code> <code>p</code> <code>t</code> determines whether any character in the
<code><a href="Data-Text-Lazy.html#t:Text">Text</a></code> <code>t</code> satisfies the predicate <code>p</code>. Subject to fusion.</p></div></div><div class="top"><p class="src"><a id="v:all" class="def">all</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Bool.html#t:Bool">Bool</a> <a href="src/Data-Text-Lazy.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-Lazy.html#v:all">all</a></code> <code>p</code> <code>t</code> determines whether all characters in the
<code><a href="Data-Text-Lazy.html#t:Text">Text</a></code> <code>t</code> satisfy the predicate <code>p</code>. Subject to fusion.</p></div></div><div class="top"><p class="src"><a id="v:maximum" class="def">maximum</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a> <a href="src/Data-Text-Lazy.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-Lazy.html#v:maximum">maximum</a></code> returns the maximum value from a <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code>, which
must be non-empty. Subject to fusion.</p></div></div><div class="top"><p class="src"><a id="v:minimum" class="def">minimum</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a> <a href="src/Data-Text-Lazy.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-Lazy.html#v:minimum">minimum</a></code> returns the minimum value from a <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code>, which
must be non-empty. Subject to fusion.</p></div></div><h1 id="g:11">Construction</h1><h2 id="g:12">Scans</h2><div class="top"><p class="src"><a id="v:scanl" class="def">scanl</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a>) -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Lazy.html#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-Lazy.html#v:scanl">scanl</a></code> is similar to <code><a href="Data-Text-Lazy.html#v:foldl">foldl</a></code>, but returns a list of
successive reduced values from the left. Subject to fusion.
Performs replacement on invalid scalar values.</p><pre>scanl f z [x1, x2, ...] == [z, z `f` x1, (z `f` x1) `f` x2, ...]</pre><p>Note that</p><pre>last (scanl f z xs) == foldl f z xs.</pre></div></div><div class="top"><p class="src"><a id="v:scanl1" class="def">scanl1</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a>) -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Lazy.html#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-Lazy.html#v:scanl1">scanl1</a></code> is a variant of <code><a href="Data-Text-Lazy.html#v:scanl">scanl</a></code> that has no starting
value argument. Subject to fusion. Performs replacement on
invalid scalar values.</p><pre>scanl1 f [x1, x2, ...] == [x1, x1 `f` x2, ...]</pre></div></div><div class="top"><p class="src"><a id="v:scanr" class="def">scanr</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a>) -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Lazy.html#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-Lazy.html#v:scanr">scanr</a></code> is the right-to-left dual of <code><a href="Data-Text-Lazy.html#v:scanl">scanl</a></code>. Performs
replacement on invalid scalar values.</p><pre>scanr f v == reverse . scanl (flip f) v . reverse</pre></div></div><div class="top"><p class="src"><a id="v:scanr1" class="def">scanr1</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a>) -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Lazy.html#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-Lazy.html#v:scanr1">scanr1</a></code> is a variant of <code><a href="Data-Text-Lazy.html#v:scanr">scanr</a></code> that has no starting
value argument. Performs replacement on invalid scalar values.</p></div></div><h2 id="g:13">Accumulating maps</h2><div class="top"><p class="src"><a id="v:mapAccumL" class="def">mapAccumL</a> :: (a -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a> -> (a, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a>)) -> a -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> (a, <a href="Data-Text-Lazy.html#t:Text">Text</a>) <a href="src/Data-Text-Lazy.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-Lazy.html#v:map">map</a></code> and <code><a href="Data-Text-Lazy.html#v:foldl-39-">foldl'</a></code>. Applies a
function to each element of a <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code>, passing an accumulating
parameter from left to right, and returns a final <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code>. Performs
replacement on invalid scalar values.</p></div></div><div class="top"><p class="src"><a id="v:mapAccumR" class="def">mapAccumR</a> :: (a -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a> -> (a, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a>)) -> a -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> (a, <a href="Data-Text-Lazy.html#t:Text">Text</a>) <a href="src/Data-Text-Lazy.html#mapAccumR" class="link">Source</a> <a href="#v:mapAccumR" class="selflink">#</a></p><div class="doc"><p>The <code><a href="Data-Text-Lazy.html#v:mapAccumR">mapAccumR</a></code> function behaves like a combination of <code><a href="Data-Text-Lazy.html#v:map">map</a></code> and
a strict <code><a href="Data-Text-Lazy.html#v:foldr">foldr</a></code>; it applies a function to each element of a
<code><a href="Data-Text-Lazy.html#t:Text">Text</a></code>, passing an accumulating parameter from right to left, and
returning a final value of this accumulator together with the new
<code><a href="Data-Text-Lazy.html#t:Text">Text</a></code>. Performs replacement on invalid scalar values.</p></div></div><h2 id="g:14">Generation and unfolding</h2><div class="top"><p class="src"><a id="v:repeat" class="def">repeat</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Lazy.html#repeat" class="link">Source</a> <a href="#v:repeat" class="selflink">#</a></p><div class="doc"><p><code><code><a href="Data-Text-Lazy.html#v:repeat">repeat</a></code> x</code> is an infinite <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code>, with <code>x</code> the value of every
element.</p></div></div><div class="top"><p class="src"><a id="v:replicate" class="def">replicate</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Int.html#t:Int64">Int64</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Lazy.html#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-Lazy.html#v:replicate">replicate</a></code> <code>n</code> <code>t</code> is a <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code> consisting of the input
<code>t</code> repeated <code>n</code> times.</p></div></div><div class="top"><p class="src"><a id="v:cycle" class="def">cycle</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Lazy.html#cycle" class="link">Source</a> <a href="#v:cycle" class="selflink">#</a></p><div class="doc"><p><code><a href="Data-Text-Lazy.html#v:cycle">cycle</a></code> ties a finite, non-empty <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code> into a circular one, or
equivalently, the infinite repetition of the original <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code>.</p></div></div><div class="top"><p class="src"><a id="v:iterate" class="def">iterate</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a>) -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Lazy.html#iterate" class="link">Source</a> <a href="#v:iterate" class="selflink">#</a></p><div class="doc"><p><code><code><a href="Data-Text-Lazy.html#v:iterate">iterate</a></code> f x</code> returns an infinite <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code> of repeated applications
of <code>f</code> to <code>x</code>:</p><pre>iterate f x == [x, f x, f (f x), ...]</pre></div></div><div class="top"><p class="src"><a id="v:unfoldr" class="def">unfoldr</a> :: (a -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Maybe.html#t:Maybe">Maybe</a> (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a>, a)) -> a -> <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Lazy.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-Lazy.html#v:unfoldr">unfoldr</a></code>
function is analogous to the List <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/GHC-OldList.html#v:unfoldr">unfoldr</a></code>. <code><a href="Data-Text-Lazy.html#v:unfoldr">unfoldr</a></code> builds a
<code><a href="Data-Text-Lazy.html#t:Text">Text</a></code> from a seed value. The function takes the element and
returns <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Maybe.html#v:Nothing">Nothing</a></code> if it is done producing the <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code>, otherwise
<code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Maybe.html#v:Just">Just</a></code> <code>(a,b)</code>. In this case, <code>a</code> is the next <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a></code> in the
string, and <code>b</code> is the seed value for further production. Performs
replacement on invalid scalar values.</p></div></div><div class="top"><p class="src"><a id="v:unfoldrN" class="def">unfoldrN</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Int.html#t:Int64">Int64</a> -> (a -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Maybe.html#t:Maybe">Maybe</a> (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a>, a)) -> a -> <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Lazy.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-Lazy.html#v:unfoldr">unfoldr</a></code>, <code><a href="Data-Text-Lazy.html#v:unfoldrN">unfoldrN</a></code> builds a <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code> from a seed
value. However, the length of the result should be limited by the
first argument to <code><a href="Data-Text-Lazy.html#v:unfoldrN">unfoldrN</a></code>. This function is more efficient than
<code><a href="Data-Text-Lazy.html#v:unfoldr">unfoldr</a></code> when the maximum length of the result is known and
correct, otherwise its performance is similar to <code><a href="Data-Text-Lazy.html#v:unfoldr">unfoldr</a></code>.
Performs replacement on invalid scalar values.</p></div></div><h1 id="g:15">Substrings</h1><h2 id="g:16">Breaking strings</h2><div class="top"><p class="src"><a id="v:take" class="def">take</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Int.html#t:Int64">Int64</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Lazy.html#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-Lazy.html#v:take">take</a></code> <code>n</code>, applied to a <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code>, returns the prefix of the
<code><a href="Data-Text-Lazy.html#t:Text">Text</a></code> of length <code>n</code>, or the <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code> itself if <code>n</code> is greater than
the length of the Text. Subject to fusion.</p></div></div><div class="top"><p class="src"><a id="v:takeEnd" class="def">takeEnd</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Int.html#t:Int64">Int64</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Lazy.html#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-Lazy.html#v:takeEnd">takeEnd</a></code> <code>n</code> <code>t</code> returns the suffix remaining after
taking <code>n</code> characters from the end of <code>t</code>.</p><p>Examples:</p><pre>takeEnd 3 "foobar" == "bar"</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.0.0/Data-Int.html#t:Int64">Int64</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Lazy.html#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-Lazy.html#v:drop">drop</a></code> <code>n</code>, applied to a <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code>, returns the suffix of the
<code><a href="Data-Text-Lazy.html#t:Text">Text</a></code> after the first <code>n</code> characters, or the empty <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code> if <code>n</code>
is greater than the length of the <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code>. Subject to fusion.</p></div></div><div class="top"><p class="src"><a id="v:dropEnd" class="def">dropEnd</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Int.html#t:Int64">Int64</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Lazy.html#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-Lazy.html#v:dropEnd">dropEnd</a></code> <code>n</code> <code>t</code> returns the prefix remaining after
dropping <code>n</code> characters from the end of <code>t</code>.</p><p>Examples:</p><pre>dropEnd 3 "foobar" == "foo"</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.0.0/Data-Char.html#t:Char">Char</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Lazy.html#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-Lazy.html#v:takeWhile">takeWhile</a></code>, applied to a predicate <code>p</code> and a <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code>,
returns the longest prefix (possibly empty) of elements that
satisfy <code>p</code>. Subject to fusion.</p></div></div><div class="top"><p class="src"><a id="v:takeWhileEnd" class="def">takeWhileEnd</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Lazy.html#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-Lazy.html#v:takeWhileEnd">takeWhileEnd</a></code>, applied to a predicate <code>p</code> and a <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code>,
returns the longest suffix (possibly empty) of elements that
satisfy <code>p</code>.
Examples:</p><pre>takeWhileEnd (=='o') "foo" == "oo"</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.0.0/Data-Char.html#t:Char">Char</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Lazy.html#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-Lazy.html#v:dropWhile">dropWhile</a></code> <code>p</code> <code>t</code> returns the suffix remaining after
<code><a href="Data-Text-Lazy.html#v:takeWhile">takeWhile</a></code> <code>p</code> <code>t</code>. Subject to fusion.</p></div></div><div class="top"><p class="src"><a id="v:dropWhileEnd" class="def">dropWhileEnd</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Lazy.html#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-Lazy.html#v:dropWhileEnd">dropWhileEnd</a></code> <code>p</code> <code>t</code> returns the prefix remaining after
dropping characters that satisfy the predicate <code>p</code> from the end of
<code>t</code>.</p><p>Examples:</p><pre>dropWhileEnd (=='.') "foo..." == "foo"</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.0.0/Data-Char.html#t:Char">Char</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Lazy.html#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-Lazy.html#v:dropAround">dropAround</a></code> <code>p</code> <code>t</code> returns the substring remaining after
dropping characters that satisfy the predicate <code>p</code> from both the
beginning and end of <code>t</code>. Subject to fusion.</p></div></div><div class="top"><p class="src"><a id="v:strip" class="def">strip</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Lazy.html#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-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Lazy.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-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Lazy.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.0.0/Data-Int.html#t:Int64">Int64</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> (<a href="Data-Text-Lazy.html#t:Text">Text</a>, <a href="Data-Text-Lazy.html#t:Text">Text</a>) <a href="src/Data-Text-Lazy.html#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-Lazy.html#v:splitAt">splitAt</a></code> <code>n t</code> returns a pair whose first element is a
prefix of <code>t</code> of length <code>n</code>, and whose second is the remainder of
the string. It is equivalent to <code>(<code><a href="Data-Text-Lazy.html#v:take">take</a></code> n t, <code><a href="Data-Text-Lazy.html#v:drop">drop</a></code> n t)</code>.</p></div></div><div class="top"><p class="src"><a id="v:span" class="def">span</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> (<a href="Data-Text-Lazy.html#t:Text">Text</a>, <a href="Data-Text-Lazy.html#t:Text">Text</a>) <a href="src/Data-Text-Lazy.html#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-Lazy.html#v:span">span</a></code>, applied to a predicate <code>p</code> and text <code>t</code>, returns
a pair whose first element is the longest prefix (possibly empty)
of <code>t</code> of elements that satisfy <code>p</code>, and whose second is the
remainder of the list.</p></div></div><div class="top"><p class="src"><a id="v:breakOn" class="def">breakOn</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> (<a href="Data-Text-Lazy.html#t:Text">Text</a>, <a href="Data-Text-Lazy.html#t:Text">Text</a>) <a href="src/Data-Text-Lazy.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-Lazy.html#v:null">null</a></code>) in <code>haystack</code>. The first element of the returned tuple
is the prefix of <code>haystack</code> before <code>needle</code> is matched. The second
is the remainder of <code>haystack</code>, starting with the match.</p><p>Examples:</p><pre>breakOn "::" "a::b::c" ==> ("a", "::b::c")
breakOn "/" "foobar" ==> ("foobar", "")</pre><p>Laws:</p><pre>append prefix match == haystack
where (prefix, match) = breakOn needle haystack</pre><p>If you need to break a string by a substring repeatedly (e.g. you
want to break on every instance of a substring), use <code><a href="Data-Text-Lazy.html#v:breakOnAll">breakOnAll</a></code>
instead, as it has lower startup overhead.</p><p>This function is strict in its first argument, and lazy in its
second.</p><p>In (unlikely) bad cases, this function's time complexity degrades
towards <em>O(n*m)</em>.</p></div></div><div class="top"><p class="src"><a id="v:breakOnEnd" class="def">breakOnEnd</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> (<a href="Data-Text-Lazy.html#t:Text">Text</a>, <a href="Data-Text-Lazy.html#t:Text">Text</a>) <a href="src/Data-Text-Lazy.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-Lazy.html#v:breakOn">breakOn</a></code>, but searches from the end of the string.</p><p>The first element of the returned tuple is the prefix of <code>haystack</code>
up to and including the last match of <code>needle</code>. The second is the
remainder of <code>haystack</code>, following the match.</p><pre>breakOnEnd "::" "a::b::c" ==> ("a::b::", "c")</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.0.0/Data-Char.html#t:Char">Char</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> (<a href="Data-Text-Lazy.html#t:Text">Text</a>, <a href="Data-Text-Lazy.html#t:Text">Text</a>) <a href="src/Data-Text-Lazy.html#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-Lazy.html#v:break">break</a></code> is like <code><a href="Data-Text-Lazy.html#v:span">span</a></code>, but the prefix returned is over
elements that fail the predicate <code>p</code>.</p></div></div><div class="top"><p class="src"><a id="v:group" class="def">group</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -> [<a href="Data-Text-Lazy.html#t:Text">Text</a>] <a href="src/Data-Text-Lazy.html#group" class="link">Source</a> <a href="#v:group" class="selflink">#</a></p><div class="doc"><p>The <code><a href="Data-Text-Lazy.html#v:group">group</a></code> function takes a <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code> and returns a list of <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code>s
such that the concatenation of the result is equal to the argument.
Moreover, each sublist in the result contains only equal elements.
For example,</p><pre>group "Mississippi" = ["M","i","ss","i","ss","i","pp","i"]</pre><p>It is a special case of <code><a href="Data-Text-Lazy.html#v:groupBy">groupBy</a></code>, which allows the programmer to
supply their own equality test.</p></div></div><div class="top"><p class="src"><a id="v:groupBy" class="def">groupBy</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> [<a href="Data-Text-Lazy.html#t:Text">Text</a>] <a href="src/Data-Text-Lazy.html#groupBy" class="link">Source</a> <a href="#v:groupBy" class="selflink">#</a></p><div class="doc"><p>The <code><a href="Data-Text-Lazy.html#v:groupBy">groupBy</a></code> function is the non-overloaded version of <code><a href="Data-Text-Lazy.html#v:group">group</a></code>.</p></div></div><div class="top"><p class="src"><a id="v:inits" class="def">inits</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -> [<a href="Data-Text-Lazy.html#t:Text">Text</a>] <a href="src/Data-Text-Lazy.html#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-Lazy.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-Lazy.html#t:Text">Text</a> -> [<a href="Data-Text-Lazy.html#t:Text">Text</a>] <a href="src/Data-Text-Lazy.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-Lazy.html#t:Text">Text</a></code>, longest
first.</p></div></div><h2 id="g:17">Breaking into many substrings</h2><div class="doc"><p>Splitting functions in this library do not perform character-wise
copies to create substrings; they just construct new <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code>s that
are slices of the original.</p></div><div class="top"><p class="src"><a id="v:splitOn" class="def">splitOn</a> <a href="src/Data-Text-Lazy.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-Lazy.html#t:Text">Text</a></td><td class="doc"><p>String to split on. If this string is empty, an error
will occur.</p></td></tr><tr><td class="src">-> <a href="Data-Text-Lazy.html#t:Text">Text</a></td><td class="doc"><p>Input text.</p></td></tr><tr><td class="src">-> [<a href="Data-Text-Lazy.html#t:Text">Text</a>]</td><td class="doc empty"> </td></tr></table></div><div class="doc"><p><em>O(m+n)</em> Break a <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code> into pieces separated by the first <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code>
argument (which cannot be an empty string), consuming the
delimiter. An empty delimiter is invalid, and will cause an error
to be raised.</p><p>Examples:</p><pre>splitOn "\r\n" "a\r\nb\r\nd\r\ne" == ["a","b","d","e"]
splitOn "aaa" "aaaXaaaXaaaXaaa" == ["","X","X","X",""]
splitOn "x" "x" == ["",""]</pre><p>and</p><pre>intercalate s . splitOn s == id
splitOn (singleton c) == split (==c)</pre><p>(Note: the string <code>s</code> to split on above cannot be empty.)</p><p>This function is strict in its first argument, and lazy in its
second.</p><p>In (unlikely) bad cases, this function's time complexity degrades
towards <em>O(n*m)</em>.</p></div></div><div class="top"><p class="src"><a id="v:split" class="def">split</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> [<a href="Data-Text-Lazy.html#t:Text">Text</a>] <a href="src/Data-Text-Lazy.html#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-Lazy.html#t:Text">Text</a></code> into components delimited by separators,
where the predicate returns True for a separator element. The
resulting components do not contain the separators. Two adjacent
separators result in an empty component in the output. eg.</p><pre>split (=='a') "aabbaca" == ["","","bb","c",""]
split (=='a') [] == [""]</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.0.0/Data-Int.html#t:Int64">Int64</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> [<a href="Data-Text-Lazy.html#t:Text">Text</a>] <a href="src/Data-Text-Lazy.html#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-Lazy.html#t:Text">Text</a></code> into components of length <code>k</code>. The last
element may be shorter than the other chunks, depending on the
length of the input. Examples:</p><pre>chunksOf 3 "foobarbaz" == ["foo","bar","baz"]
chunksOf 4 "haskell.org" == ["hask","ell.","org"]</pre></div></div><h2 id="g:18">Breaking into lines and words</h2><div class="top"><p class="src"><a id="v:lines" class="def">lines</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -> [<a href="Data-Text-Lazy.html#t:Text">Text</a>] <a href="src/Data-Text-Lazy.html#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-Lazy.html#t:Text">Text</a></code> up into a list of <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code>s at
newline <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a></code>s. The resulting strings do not contain newlines.</p></div></div><div class="top"><p class="src"><a id="v:words" class="def">words</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -> [<a href="Data-Text-Lazy.html#t:Text">Text</a>] <a href="src/Data-Text-Lazy.html#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-Lazy.html#t:Text">Text</a></code> up into a list of words, delimited by <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.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-Lazy.html#t:Text">Text</a>] -> <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Lazy.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-Lazy.html#t:Text">Text</a>] -> <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Lazy.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:19">Predicates</h1><div class="top"><p class="src"><a id="v:isPrefixOf" class="def">isPrefixOf</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Bool.html#t:Bool">Bool</a> <a href="src/Data-Text-Lazy.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-Lazy.html#v:isPrefixOf">isPrefixOf</a></code> function takes two <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code>s and returns
<code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Bool.html#v:True">True</a></code> iff the first is a prefix of the second. Subject to fusion.</p></div></div><div class="top"><p class="src"><a id="v:isSuffixOf" class="def">isSuffixOf</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Bool.html#t:Bool">Bool</a> <a href="src/Data-Text-Lazy.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-Lazy.html#v:isSuffixOf">isSuffixOf</a></code> function takes two <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code>s and returns
<code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Bool.html#v:True">True</a></code> iff the first is a suffix of the second.</p></div></div><div class="top"><p class="src"><a id="v:isInfixOf" class="def">isInfixOf</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Bool.html#t:Bool">Bool</a> <a href="src/Data-Text-Lazy.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-Lazy.html#v:isInfixOf">isInfixOf</a></code> function takes two <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code>s and returns
<code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Bool.html#v:True">True</a></code> iff the first is contained, wholly and intact, anywhere
within the second.</p><p>This function is strict in its first argument, and lazy in its
second.</p><p>In (unlikely) bad cases, this function's time complexity degrades
towards <em>O(n*m)</em>.</p></div></div><h2 id="g:20">View patterns</h2><div class="top"><p class="src"><a id="v:stripPrefix" class="def">stripPrefix</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Lazy.html#stripPrefix" class="link">Source</a> <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 "foo" "foobar" == Just "bar"
stripPrefix "" "baz" == Just "baz"
stripPrefix "foo" "quux" == Nothing</pre><p>This is particularly useful with the <code>ViewPatterns</code> extension to
GHC, as follows:</p><pre>{-# LANGUAGE ViewPatterns #-}
import Data.Text.Lazy as T
fnordLength :: Text -> Int
fnordLength (stripPrefix "fnord" -> 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-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Lazy.html#stripSuffix" class="link">Source</a> <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 "bar" "foobar" == Just "foo"
stripSuffix "" "baz" == Just "baz"
stripSuffix "foo" "quux" == Nothing</pre><p>This is particularly useful with the <code>ViewPatterns</code> extension to
GHC, as follows:</p><pre>{-# LANGUAGE ViewPatterns #-}
import Data.Text.Lazy as T
quuxLength :: Text -> Int
quuxLength (stripSuffix "quux" -> 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-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Maybe.html#t:Maybe">Maybe</a> (<a href="Data-Text-Lazy.html#t:Text">Text</a>, <a href="Data-Text-Lazy.html#t:Text">Text</a>, <a href="Data-Text-Lazy.html#t:Text">Text</a>) <a href="src/Data-Text-Lazy.html#commonPrefixes" class="link">Source</a> <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.0.0/Data-Maybe.html#v:Nothing">Nothing</a></code>.</p><p>Examples:</p><pre>commonPrefixes "foobar" "fooquux" == Just ("foo","bar","quux")
commonPrefixes "veeble" "fetzer" == Nothing
commonPrefixes "" "baz" == Nothing</pre></div></div><h1 id="g:21">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.0.0/Data-Char.html#t:Char">Char</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Lazy.html#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-Lazy.html#v:filter">filter</a></code>, applied to a predicate and a <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code>,
returns a <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code> containing those characters that satisfy the
predicate.</p></div></div><div class="top"><p class="src"><a id="v:find" class="def">find</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a> <a href="src/Data-Text-Lazy.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-Lazy.html#v:find">find</a></code> function takes a predicate and a <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code>, and
returns the first element in matching the predicate, or <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Maybe.html#v:Nothing">Nothing</a></code>
if there is no such element.</p></div></div><div class="top"><p class="src"><a id="v:breakOnAll" class="def">breakOnAll</a> <a href="src/Data-Text-Lazy.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-Lazy.html#t:Text">Text</a></td><td class="doc"><p><code>needle</code> to search for</p></td></tr><tr><td class="src">-> <a href="Data-Text-Lazy.html#t:Text">Text</a></td><td class="doc"><p><code>haystack</code> in which to search</p></td></tr><tr><td class="src">-> [(<a href="Data-Text-Lazy.html#t:Text">Text</a>, <a href="Data-Text-Lazy.html#t:Text">Text</a>)]</td><td class="doc empty"> </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 "::" ""
==> []
breakOnAll "/" "a/b/c/"
==> [("a", "/b/c/"), ("a/b", "/c/"), ("a/b/c", "/")]</pre><p>This function is strict in its first argument, and lazy in its
second.</p><p>In (unlikely) bad cases, this function's time complexity degrades
towards <em>O(n*m)</em>.</p><p>The <code>needle</code> parameter may not be empty.</p></div></div><div class="top"><p class="src"><a id="v:partition" class="def">partition</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> (<a href="Data-Text-Lazy.html#t:Text">Text</a>, <a href="Data-Text-Lazy.html#t:Text">Text</a>) <a href="src/Data-Text-Lazy.html#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-Lazy.html#v:partition">partition</a></code> function takes a predicate and a <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code>,
and returns the pair of <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code>s with elements which do and do not
satisfy the predicate, respectively; i.e.</p><pre>partition p t == (filter p t, filter (not . p) t)</pre></div></div><h1 id="g:22">Indexing</h1><div class="top"><p class="src"><a id="v:index" class="def">index</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Int.html#t:Int64">Int64</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a> <a href="src/Data-Text-Lazy.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-Lazy.html#t:Text">Text</a></code> index (subscript) operator, starting from 0.</p></div></div><div class="top"><p class="src"><a id="v:count" class="def">count</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Int.html#t:Int64">Int64</a> <a href="src/Data-Text-Lazy.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-Lazy.html#v:count">count</a></code> function returns the number of times the
query string appears in the given <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code>. An empty query string is
invalid, and will cause an error to be raised.</p><p>In (unlikely) bad cases, this function's time complexity degrades
towards <em>O(n*m)</em>.</p></div></div><h1 id="g:23">Zipping and unzipping</h1><div class="top"><p class="src"><a id="v:zip" class="def">zip</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> [(<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a>, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a>)] <a href="src/Data-Text-Lazy.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-Lazy.html#v:zip">zip</a></code> takes two <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code>s and returns a list of
corresponding pairs of bytes. If one input <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code> is short,
excess elements of the longer <code><a href="Data-Text-Lazy.html#t:Text">Text</a></code> are discarded. This is
equivalent to a pair of <code><a href="Data-Text-Lazy.html#v:unpack">unpack</a></code> operations.</p></div></div><div class="top"><p class="src"><a id="v:zipWith" class="def">zipWith</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Char.html#t:Char">Char</a>) -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="src/Data-Text-Lazy.html#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-Lazy.html#v:zipWith">zipWith</a></code> generalises <code><a href="Data-Text-Lazy.html#v:zip">zip</a></code> by zipping with the function
given as the first argument, instead of a tupling function.
Performs replacement on invalid scalar values.</p></div></div><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.0.0/GHC-Exts.html#t:IsList">IsList</a> <a href="Data-Text-Lazy.html#t:Text">Text</a></span> <a href="src/Data-Text-Lazy.html#line-365" class="link">Source</a> <a href="#v:-36-fIsListText" class="selflink">#</a></td><td class="doc empty"> </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.0.0/GHC-Exts.html#t:Item">Item</a> <a href="Data-Text-Lazy.html#t:Text">Text</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.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.0.0/GHC-Exts.html#t:Item">Item</a> <a href="Data-Text-Lazy.html#t:Text">Text</a>] -> <a href="Data-Text-Lazy.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.0.0/Data-Int.html#t:Int">Int</a> -> [<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/GHC-Exts.html#t:Item">Item</a> <a href="Data-Text-Lazy.html#t:Text">Text</a>] -> <a href="Data-Text-Lazy.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-Lazy.html#t:Text">Text</a> -> [<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/GHC-Exts.html#t:Item">Item</a> <a href="Data-Text-Lazy.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.0.0/Data-Eq.html#t:Eq">Eq</a> <a href="Data-Text-Lazy.html#t:Text">Text</a></span> <a href="src/Data-Text-Lazy.html#line-314" class="link">Source</a> <a href="#v:-36-fEqText" class="selflink">#</a></td><td class="doc empty"> </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-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.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-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.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.0.0/Data-Data.html#t:Data">Data</a> <a href="Data-Text-Lazy.html#t:Text">Text</a></span> <a href="src/Data-Text-Lazy.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="Data-Text.html">Data.Text</a>.</code><code><a href="Data-Text.html#v:Text">Text</a></code></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.0.0/Data-Data.html#t:Data">Data</a> d => c (d -> b) -> d -> c b) -> (<span class="keyword">forall</span> g. g -> c g) -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> c <a href="Data-Text-Lazy.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.0.0/Data-Data.html#t:Data">Data</a> b => c (b -> r) -> c r) -> (<span class="keyword">forall</span> r. r -> c r) -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Data.html#t:Constr">Constr</a> -> c <a href="Data-Text-Lazy.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-Lazy.html#t:Text">Text</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.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-Lazy.html#t:Text">Text</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.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.0.0/Data-Typeable-Internal.html#t:Typeable">Typeable</a> (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Kind.html#t:-42-">*</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Kind.html#t:-42-">*</a>) t => (<span class="keyword">forall</span> d. <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Data.html#t:Data">Data</a> d => c (t d)) -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Maybe.html#t:Maybe">Maybe</a> (c <a href="Data-Text-Lazy.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.0.0/Data-Typeable-Internal.html#t:Typeable">Typeable</a> (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Kind.html#t:-42-">*</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Kind.html#t:-42-">*</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Kind.html#t:-42-">*</a>) t => (<span class="keyword">forall</span> d e. (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Data.html#t:Data">Data</a> d, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Data.html#t:Data">Data</a> e) => c (t d e)) -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Maybe.html#t:Maybe">Maybe</a> (c <a href="Data-Text-Lazy.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.0.0/Data-Data.html#t:Data">Data</a> b => b -> b) -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="#v:gmapT" class="selflink">#</a></p><p class="src"><a href="#v:gmapQl">gmapQl</a> :: (r -> r' -> r) -> r -> (<span class="keyword">forall</span> d. <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Data.html#t:Data">Data</a> d => d -> r') -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> r <a href="#v:gmapQl" class="selflink">#</a></p><p class="src"><a href="#v:gmapQr">gmapQr</a> :: (r' -> r -> r) -> r -> (<span class="keyword">forall</span> d. <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Data.html#t:Data">Data</a> d => d -> r') -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> 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.0.0/Data-Data.html#t:Data">Data</a> d => d -> u) -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> [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.0.0/Data-Int.html#t:Int">Int</a> -> (<span class="keyword">forall</span> d. <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Data.html#t:Data">Data</a> d => d -> u) -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> 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.0.0/Control-Monad.html#t:Monad">Monad</a> m => (<span class="keyword">forall</span> d. <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Data.html#t:Data">Data</a> d => d -> m d) -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> m <a href="Data-Text-Lazy.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.0.0/Control-Monad.html#t:MonadPlus">MonadPlus</a> m => (<span class="keyword">forall</span> d. <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Data.html#t:Data">Data</a> d => d -> m d) -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> m <a href="Data-Text-Lazy.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.0.0/Control-Monad.html#t:MonadPlus">MonadPlus</a> m => (<span class="keyword">forall</span> d. <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Data.html#t:Data">Data</a> d => d -> m d) -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> m <a href="Data-Text-Lazy.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.0.0/Data-Ord.html#t:Ord">Ord</a> <a href="Data-Text-Lazy.html#t:Text">Text</a></span> <a href="src/Data-Text-Lazy.html#line-318" class="link">Source</a> <a href="#v:-36-fOrdText" class="selflink">#</a></td><td class="doc empty"> </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-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Ord.html#t:Ordering">Ordering</a> <a href="#v:compare" class="selflink">#</a></p><p class="src"><a href="#v:-60-">(<)</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Bool.html#t:Bool">Bool</a> <a href="#v:-60-" class="selflink">#</a></p><p class="src"><a href="#v:-60--61-">(<=)</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Bool.html#t:Bool">Bool</a> <a href="#v:-60--61-" class="selflink">#</a></p><p class="src"><a href="#v:-62-">(>)</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Bool.html#t:Bool">Bool</a> <a href="#v:-62-" class="selflink">#</a></p><p class="src"><a href="#v:-62--61-">(>=)</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.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-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="#v:max" class="selflink">#</a></p><p class="src"><a href="#v:min">min</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="#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.0.0/Text-Read.html#t:Read">Read</a> <a href="Data-Text-Lazy.html#t:Text">Text</a></span> <a href="src/Data-Text-Lazy.html#line-341" class="link">Source</a> <a href="#v:-36-fReadText" class="selflink">#</a></td><td class="doc empty"> </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.0.0/Data-Int.html#t:Int">Int</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Text-ParserCombinators-ReadP.html#t:ReadS">ReadS</a> <a href="Data-Text-Lazy.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.0.0/Text-ParserCombinators-ReadP.html#t:ReadS">ReadS</a> [<a href="Data-Text-Lazy.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.0.0/Text-ParserCombinators-ReadPrec.html#t:ReadPrec">ReadPrec</a> <a href="Data-Text-Lazy.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.0.0/Text-ParserCombinators-ReadPrec.html#t:ReadPrec">ReadPrec</a> [<a href="Data-Text-Lazy.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:Show:Show:6" class="instance expander" onclick="toggleSection('i:o:ic:Show:Show:6')"></span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Text-Show.html#t:Show">Show</a> <a href="Data-Text-Lazy.html#t:Text">Text</a></span> <a href="src/Data-Text-Lazy.html#line-338" class="link">Source</a> <a href="#v:-36-fShowText" class="selflink">#</a></td><td class="doc empty"> </td></tr><tr><td colspan="2"><div id="section.i:o:ic:Show:Show:6" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:showsPrec">showsPrec</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Int.html#t:Int">Int</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Text-Show.html#t:ShowS">ShowS</a> <a href="#v:showsPrec" class="selflink">#</a></p><p class="src"><a href="#v:show">show</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-String.html#t:String">String</a> <a href="#v:show" class="selflink">#</a></p><p class="src"><a href="#v:showList">showList</a> :: [<a href="Data-Text-Lazy.html#t:Text">Text</a>] -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Text-Show.html#t:ShowS">ShowS</a> <a href="#v:showList" 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:7" class="instance expander" onclick="toggleSection('i:o:ic:IsString:IsString:7')"></span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-String.html#t:IsString">IsString</a> <a href="Data-Text-Lazy.html#t:Text">Text</a></span> <a href="src/Data-Text-Lazy.html#line-361" class="link">Source</a> <a href="#v:-36-fIsStringText" class="selflink">#</a></td><td class="doc empty"> </td></tr><tr><td colspan="2"><div id="section.i:o:ic:IsString:IsString:7" 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.0.0/Data-String.html#t:String">String</a> -> <a href="Data-Text-Lazy.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:8" class="instance expander" onclick="toggleSection('i:o:ic:Semigroup:Semigroup:8')"></span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Semigroup.html#t:Semigroup">Semigroup</a> <a href="Data-Text-Lazy.html#t:Text">Text</a></span> <a href="src/Data-Text-Lazy.html#line-348" class="link">Source</a> <a href="#v:-36-fSemigroupText" class="selflink">#</a></td><td class="doc empty"> </td></tr><tr><td colspan="2"><div id="section.i:o:ic:Semigroup:Semigroup:8" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:-60--62-">(<>)</a> :: <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="#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.0.0/Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.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.0.0/Prelude.html#t:Integral">Integral</a> b => b -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.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:9" class="instance expander" onclick="toggleSection('i:o:ic:Monoid:Monoid:9')"></span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Data-Monoid.html#t:Monoid">Monoid</a> <a href="Data-Text-Lazy.html#t:Text">Text</a></span> <a href="src/Data-Text-Lazy.html#line-352" class="link">Source</a> <a href="#v:-36-fMonoidText" class="selflink">#</a></td><td class="doc empty"> </td></tr><tr><td colspan="2"><div id="section.i:o:ic:Monoid:Monoid:9" 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-Lazy.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-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> -> <a href="Data-Text-Lazy.html#t:Text">Text</a> <a href="#v:mappend" class="selflink">#</a></p><p class="src"><a href="#v:mconcat">mconcat</a> :: [<a href="Data-Text-Lazy.html#t:Text">Text</a>] -> <a href="Data-Text-Lazy.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:10" class="instance expander" onclick="toggleSection('i:o:ic:PrintfArg:PrintfArg:10')"></span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.0/Text-Printf.html#t:PrintfArg">PrintfArg</a> <a href="Data-Text-Lazy.html#t:Text">Text</a></span> <a href="src/Data-Text-Lazy.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:10" 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-Lazy.html#t:Text">Text</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.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-Lazy.html#t:Text">Text</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.0.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:11" class="instance expander" onclick="toggleSection('i:o:ic:Binary:Binary:11')"></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-Lazy.html#t:Text">Text</a></span> <a href="src/Data-Text-Lazy.html#line-377" class="link">Source</a> <a href="#v:-36-fBinaryText" class="selflink">#</a></td><td class="doc empty"> </td></tr><tr><td colspan="2"><div id="section.i:o:ic:Binary:Binary:11" 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-Lazy.html#t:Text">Text</a> -> <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-Lazy.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-Lazy.html#t:Text">Text</a>] -> <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:12" class="instance expander" onclick="toggleSection('i:o:ic:NFData:NFData:12')"></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-Lazy.html#t:Text">Text</a></span> <a href="src/Data-Text-Lazy.html#line-372" class="link">Source</a> <a href="#v:-36-fNFDataText" class="selflink">#</a></td><td class="doc empty"> </td></tr><tr><td colspan="2"><div id="section.i:o:ic:NFData:NFData:12" 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-Lazy.html#t:Text">Text</a> -> () <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.2</p></div></body></html>
|