/usr/share/doc/haskell-edison-api-doc/html/Data-Edison-Seq.html is in libghc-edison-api-doc 1.2.1-17.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 | <!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.Edison.Seq</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
window.onload = function () {pageLoad();setSynopsis("mini_Data-Edison-Seq.html");};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="src/Data-Edison-Seq.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">EdisonAPI-1.2.1: A library of efficient, purely-functional data structures (API)</p></div><div id="content"><div id="module-header"><table class="info"><tr><th>Portability</th><td>GHC, Hugs (MPTC and FD)</td></tr><tr><th>Stability</th><td>stable</td></tr><tr><th>Maintainer</th><td>robdockins AT fastmail DOT fm</td></tr><tr><th>Safe Haskell</th><td>Safe-Infered</td></tr></table><p class="caption">Data.Edison.Seq</p></div><div id="table-of-contents"><p class="caption">Contents</p><ul><li><a href="#g:1">Superclass aliases
</a><ul><li><a href="#g:2">Functor aliases
</a></li><li><a href="#g:3">Monad aliases
</a></li><li><a href="#g:4">MonadPlus aliases
</a></li></ul></li><li><a href="#g:5">The Sequence class
</a></li></ul></div><div id="description"><p class="caption">Description</p><div class="doc"><p>The sequence abstraction is usually viewed as a hierarchy of ADTs
including lists, queues, deques, catenable lists, etc. However, such
a hierarchy is based on efficiency rather than functionality. For example,
a list supports all the operations that a deque supports, even though
some of the operations may be inefficient. Hence, in Edison, all sequence
data structures are defined as instances of the single Sequence class:
</p><pre> class (Functor s, MonadPlus s) => Sequence s</pre><p>All sequences are also instances of <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Functor">Functor</a></code>, <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a></code>, and <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:MonadPlus">MonadPlus</a></code>.
In addition, all sequences are expected to be instances of <code>Eq</code>, <code>Show</code>,
and <code>Read</code>, although this is not enforced.
</p><p>We follow the naming convention that every module implementing sequences
defines a type constructor named <code>Seq</code>.
</p><p>For each method the "default" complexity is listed. Individual
implementations may differ for some methods. The documentation for
each implementation will list those methods for which the running time
differs from these.
</p><p>A description of each Sequence function appears below. In most cases
psudeocode is also provided. Obviously, the psudeocode is illustrative only.
</p><p>Sequences are represented in psudecode between angle brackets:
</p><pre> <x0,x1,x2...,xn-1>
</pre><p>Such that <code>x0</code> is at the left (front) of the sequence and
<code>xn-1</code> is at the right (rear) of the sequence.
</p></div></div><div id="synopsis"><p id="control.syn" class="caption expander" onclick="toggleSection('syn')">Synopsis</p><ul id="section.syn" class="hide" onclick="toggleSection('syn')"><li class="src short"><a href="#v:map">map</a> :: <a href="Data-Edison-Seq.html#t:Sequence">Sequence</a> s => (a -> b) -> s a -> s b</li><li class="src short"><a href="#v:singleton">singleton</a> :: <a href="Data-Edison-Seq.html#t:Sequence">Sequence</a> s => a -> s a</li><li class="src short"><a href="#v:concatMap">concatMap</a> :: <a href="Data-Edison-Seq.html#t:Sequence">Sequence</a> s => (a -> s b) -> s a -> s b</li><li class="src short"><a href="#v:empty">empty</a> :: <a href="Data-Edison-Seq.html#t:Sequence">Sequence</a> s => s a</li><li class="src short"><a href="#v:append">append</a> :: <a href="Data-Edison-Seq.html#t:Sequence">Sequence</a> s => s a -> s a -> s a</li><li class="src short"><span class="keyword">class</span> (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Functor">Functor</a> s, <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:MonadPlus">MonadPlus</a> s) => <a href="#t:Sequence">Sequence</a> s <span class="keyword">where</span><ul class="subs"><li><a href="#v:lcons">lcons</a> :: a -> s a -> s a</li><li><a href="#v:rcons">rcons</a> :: a -> s a -> s a</li><li><a href="#v:fromList">fromList</a> :: [a] -> s a</li><li><a href="#v:copy">copy</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -> a -> s a</li><li><a href="#v:lview">lview</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m => s a -> m (a, s a)</li><li><a href="#v:lhead">lhead</a> :: s a -> a</li><li><a href="#v:lheadM">lheadM</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m => s a -> m a</li><li><a href="#v:ltail">ltail</a> :: s a -> s a</li><li><a href="#v:ltailM">ltailM</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m => s a -> m (s a)</li><li><a href="#v:rview">rview</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m => s a -> m (a, s a)</li><li><a href="#v:rhead">rhead</a> :: s a -> a</li><li><a href="#v:rheadM">rheadM</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m => s a -> m a</li><li><a href="#v:rtail">rtail</a> :: s a -> s a</li><li><a href="#v:rtailM">rtailM</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m => s a -> m (s a)</li><li><a href="#v:null">null</a> :: s a -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a></li><li><a href="#v:size">size</a> :: s a -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a></li><li><a href="#v:toList">toList</a> :: s a -> [a]</li><li><a href="#v:concat">concat</a> :: s (s a) -> s a</li><li><a href="#v:reverse">reverse</a> :: s a -> s a</li><li><a href="#v:reverseOnto">reverseOnto</a> :: s a -> s a -> s a</li><li><a href="#v:fold">fold</a> :: (a -> b -> b) -> b -> s a -> b</li><li><a href="#v:fold-39-">fold'</a> :: (a -> b -> b) -> b -> s a -> b</li><li><a href="#v:fold1">fold1</a> :: (a -> a -> a) -> s a -> a</li><li><a href="#v:fold1-39-">fold1'</a> :: (a -> a -> a) -> s a -> a</li><li><a href="#v:foldr">foldr</a> :: (a -> b -> b) -> b -> s a -> b</li><li><a href="#v:foldr-39-">foldr'</a> :: (a -> b -> b) -> b -> s a -> b</li><li><a href="#v:foldl">foldl</a> :: (b -> a -> b) -> b -> s a -> b</li><li><a href="#v:foldl-39-">foldl'</a> :: (b -> a -> b) -> b -> s a -> b</li><li><a href="#v:foldr1">foldr1</a> :: (a -> a -> a) -> s a -> a</li><li><a href="#v:foldr1-39-">foldr1'</a> :: (a -> a -> a) -> s a -> a</li><li><a href="#v:foldl1">foldl1</a> :: (a -> a -> a) -> s a -> a</li><li><a href="#v:foldl1-39-">foldl1'</a> :: (a -> a -> a) -> s a -> a</li><li><a href="#v:reducer">reducer</a> :: (a -> a -> a) -> a -> s a -> a</li><li><a href="#v:reducer-39-">reducer'</a> :: (a -> a -> a) -> a -> s a -> a</li><li><a href="#v:reducel">reducel</a> :: (a -> a -> a) -> a -> s a -> a</li><li><a href="#v:reducel-39-">reducel'</a> :: (a -> a -> a) -> a -> s a -> a</li><li><a href="#v:reduce1">reduce1</a> :: (a -> a -> a) -> s a -> a</li><li><a href="#v:reduce1-39-">reduce1'</a> :: (a -> a -> a) -> s a -> a</li><li><a href="#v:take">take</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -> s a -> s a</li><li><a href="#v:drop">drop</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -> s a -> s a</li><li><a href="#v:splitAt">splitAt</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -> s a -> (s a, s a)</li><li><a href="#v:subseq">subseq</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -> s a -> s a</li><li><a href="#v:filter">filter</a> :: (a -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a>) -> s a -> s a</li><li><a href="#v:partition">partition</a> :: (a -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a>) -> s a -> (s a, s a)</li><li><a href="#v:takeWhile">takeWhile</a> :: (a -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a>) -> s a -> s a</li><li><a href="#v:dropWhile">dropWhile</a> :: (a -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a>) -> s a -> s a</li><li><a href="#v:splitWhile">splitWhile</a> :: (a -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a>) -> s a -> (s a, s a)</li><li><a href="#v:inBounds">inBounds</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -> s a -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a></li><li><a href="#v:lookup">lookup</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -> s a -> a</li><li><a href="#v:lookupM">lookupM</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m => <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -> s a -> m a</li><li><a href="#v:lookupWithDefault">lookupWithDefault</a> :: a -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -> s a -> a</li><li><a href="#v:update">update</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -> a -> s a -> s a</li><li><a href="#v:adjust">adjust</a> :: (a -> a) -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -> s a -> s a</li><li><a href="#v:mapWithIndex">mapWithIndex</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -> a -> b) -> s a -> s b</li><li><a href="#v:foldrWithIndex">foldrWithIndex</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -> a -> b -> b) -> b -> s a -> b</li><li><a href="#v:foldrWithIndex-39-">foldrWithIndex'</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -> a -> b -> b) -> b -> s a -> b</li><li><a href="#v:foldlWithIndex">foldlWithIndex</a> :: (b -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -> a -> b) -> b -> s a -> b</li><li><a href="#v:foldlWithIndex-39-">foldlWithIndex'</a> :: (b -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -> a -> b) -> b -> s a -> b</li><li><a href="#v:zip">zip</a> :: s a -> s b -> s (a, b)</li><li><a href="#v:zip3">zip3</a> :: s a -> s b -> s c -> s (a, b, c)</li><li><a href="#v:zipWith">zipWith</a> :: (a -> b -> c) -> s a -> s b -> s c</li><li><a href="#v:zipWith3">zipWith3</a> :: (a -> b -> c -> d) -> s a -> s b -> s c -> s d</li><li><a href="#v:unzip">unzip</a> :: s (a, b) -> (s a, s b)</li><li><a href="#v:unzip3">unzip3</a> :: s (a, b, c) -> (s a, s b, s c)</li><li><a href="#v:unzipWith">unzipWith</a> :: (a -> b) -> (a -> c) -> s a -> (s b, s c)</li><li><a href="#v:unzipWith3">unzipWith3</a> :: (a -> b) -> (a -> c) -> (a -> d) -> s a -> (s b, s c, s d)</li><li><a href="#v:strict">strict</a> :: s a -> s a</li><li><a href="#v:strictWith">strictWith</a> :: (a -> b) -> s a -> s a</li><li><a href="#v:structuralInvariant">structuralInvariant</a> :: s a -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a></li><li><a href="#v:instanceName">instanceName</a> :: s a -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a></li></ul></li></ul></div><div id="interface"><h1 id="g:1">Superclass aliases
</h1><h2 id="g:2">Functor aliases
</h2><div class="top"><p class="src"><a name="v:map" class="def">map</a> :: <a href="Data-Edison-Seq.html#t:Sequence">Sequence</a> s => (a -> b) -> s a -> s b<a href="src/Data-Edison-Seq.html#map" class="link">Source</a></p><div class="doc"><p>Return the result of applying a function to
every element of a sequence. Identical
to <code>fmap</code> from <code>Functor</code>.
</p><pre> map f <x0,...,xn-1> = <f x0,...,f xn-1>
</pre><p><em>Axioms:</em>
</p><ul><li><pre>map f empty = empty</pre></li><li><pre>map f (lcons x xs) = lcons (f x) (map f xs)</pre></li></ul><p>This function is always <em>unambiguous</em>.
</p><p>Default running time: <code>O( t * n )</code>
where <code>t</code> is the running time of <code>f</code>
</p></div></div><h2 id="g:3">Monad aliases
</h2><div class="top"><p class="src"><a name="v:singleton" class="def">singleton</a> :: <a href="Data-Edison-Seq.html#t:Sequence">Sequence</a> s => a -> s a<a href="src/Data-Edison-Seq.html#singleton" class="link">Source</a></p><div class="doc"><p>Create a singleton sequence. Identical to <code>return</code>
from <code>Monad</code>.
</p><pre> singleton x = <x>
</pre><p><em>Axioms:</em>
</p><ul><li><pre>singleton x = lcons x empty = rcons x empty</pre></li></ul><p>This function is always <em>unambiguous</em>.
</p><p>Default running time: <code>O( 1 )</code>
</p></div></div><div class="top"><p class="src"><a name="v:concatMap" class="def">concatMap</a> :: <a href="Data-Edison-Seq.html#t:Sequence">Sequence</a> s => (a -> s b) -> s a -> s b<a href="src/Data-Edison-Seq.html#concatMap" class="link">Source</a></p><div class="doc"><p>Apply a sequence-producing function to every element
of a sequence and flatten the result. <code><a href="Data-Edison-Seq.html#v:concatMap">concatMap</a></code>
is the bind <code>(>>=)</code> operation of from <code>Monad</code> with the
arguments in the reverse order.
</p><pre> concatMap f xs = concat (map f xs)
</pre><p><em>Axioms:</em>
</p><ul><li><pre>concatMap f xs = concat (map f xs)</pre></li></ul><p>This function is always <em>unambiguous</em>.
</p><p>Default running time: <code>O( t * n + m )</code>
where <code>n</code> is the length of the input sequence, <code>m</code> is the
length of the output sequence, and <code>t</code> is the running time of <code>f</code>
</p></div></div><h2 id="g:4">MonadPlus aliases
</h2><div class="top"><p class="src"><a name="v:empty" class="def">empty</a> :: <a href="Data-Edison-Seq.html#t:Sequence">Sequence</a> s => s a<a href="src/Data-Edison-Seq.html#empty" class="link">Source</a></p><div class="doc"><p>The empty sequence. Identical to <code>mzero</code>
from <code>MonadPlus</code>.
</p><pre> empty = <>
</pre><p>This function is always <em>unambiguous</em>.
</p><p>Default running time: <code>O( 1 )</code>
</p></div></div><div class="top"><p class="src"><a name="v:append" class="def">append</a> :: <a href="Data-Edison-Seq.html#t:Sequence">Sequence</a> s => s a -> s a -> s a<a href="src/Data-Edison-Seq.html#append" class="link">Source</a></p><div class="doc"><p>Append two sequence, with the first argument on the left
and the second argument on the right. Identical to <code>mplus</code>
from <code>MonadPlus</code>.
</p><pre> append <x0,...,xn-1> <y0,...,ym-1> = <x0,...,xn-1,y0,...,ym-1>
</pre><p><em>Axioms:</em>
</p><ul><li><pre>append xs ys = foldr lcons ys xs</pre></li></ul><p>This function is always <em>unambiguous</em>.
</p><p>Default running time: <code>O( n1 )</code>
</p></div></div><h1 id="g:5">The Sequence class
</h1><div class="top"><p class="src"><span class="keyword">class</span> (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Functor">Functor</a> s, <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:MonadPlus">MonadPlus</a> s) => <a name="t:Sequence" class="def">Sequence</a> s <span class="keyword">where</span><a href="src/Data-Edison-Seq.html#Sequence" class="link">Source</a></p><div class="doc"><p>The <code><a href="Data-Edison-Seq.html#t:Sequence">Sequence</a></code> class defines an interface for datatypes which
implement sequences. A description for each function is
given below.
</p></div><div class="subs methods"><p class="caption">Methods</p><p class="src"><a name="v:lcons" class="def">lcons</a> :: a -> s a -> s a<a href="src/Data-Edison-Seq.html#lcons" class="link">Source</a></p><div class="doc"><p>Add a new element to the front/left of a sequence
</p><pre> lcons x <x0,...,xn-1> = <x,x0,...,xn-1>
</pre><p><em>Axioms:</em>
</p><ul><li><pre>lcons x xs = append (singleton x) xs</pre></li></ul><p>This function is always <em>unambiguous</em>.
</p><p>Default running time: <code>O( 1 )</code>
</p></div><p class="src"><a name="v:rcons" class="def">rcons</a> :: a -> s a -> s a<a href="src/Data-Edison-Seq.html#rcons" class="link">Source</a></p><div class="doc"><p>Add a new element to the right/rear of a sequence
</p><pre> rcons x <x0,...,xn-1> = <x0,...,xn-1,x>
</pre><p><em>Axioms:</em>
</p><ul><li><pre>rcons x xs = append xs (singleton x)</pre></li></ul><p>This function is always <em>unambiguous</em>.
</p><p>Default running time: <code>O( n )</code>
</p></div><p class="src"><a name="v:fromList" class="def">fromList</a> :: [a] -> s a<a href="src/Data-Edison-Seq.html#fromList" class="link">Source</a></p><div class="doc"><p>Convert a list into a sequence
</p><pre> fromList [x0,...,xn-1] = <x0,...,xn-1>
</pre><p><em>Axioms:</em>
</p><ul><li><pre>fromList xs = foldr lcons empty xs</pre></li></ul><p>This function is always <em>unambiguous</em>.
</p><p>Default running time: <code>O( n )</code>
</p></div><p class="src"><a name="v:copy" class="def">copy</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -> a -> s a<a href="src/Data-Edison-Seq.html#copy" class="link">Source</a></p><div class="doc"><p>Create a sequence containing <code>n</code> copies of the given element.
Return <code><a href="Data-Edison-Seq.html#v:empty">empty</a></code> if <code>n<0</code>.
</p><pre>copy n x = <x,...,x></pre><p><em>Axioms:</em>
</p><ul><li><pre>n > 0 ==> copy n x = cons x (copy (n-1) x)</pre></li><li><pre>n <= 0 ==> copy n x = empty</pre></li></ul><p>This function is always <em>unambiguous</em>.
</p><p>Default running time: <code>O( n )</code>
</p></div><p class="src"><a name="v:lview" class="def">lview</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m => s a -> m (a, s a)<a href="src/Data-Edison-Seq.html#lview" class="link">Source</a></p><div class="doc"><p>Separate a sequence into its first (leftmost) element and the
remaining sequence. Calls <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#v:fail">fail</a></code> if the sequence is empty.
</p><p><em>Axioms:</em>
</p><ul><li><pre>lview empty = fail</pre></li><li><pre>lview (lcons x xs) = return (x,xs)</pre></li></ul><p>This function is always <em>unambiguous</em>.
</p><p>Default running time: <code>O( 1 )</code>
</p></div><p class="src"><a name="v:lhead" class="def">lhead</a> :: s a -> a<a href="src/Data-Edison-Seq.html#lhead" class="link">Source</a></p><div class="doc"><p>Return the first element of a sequence.
Signals an error if the sequence is empty.
</p><p><em>Axioms:</em>
</p><ul><li><pre>lhead empty = undefined</pre></li><li><pre>lhead (lcons x xs) = x</pre></li></ul><p>This function is always <em>unambiguous</em>.
</p><p>Default running time: <code>O( 1 )</code>
</p></div><p class="src"><a name="v:lheadM" class="def">lheadM</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m => s a -> m a<a href="src/Data-Edison-Seq.html#lheadM" class="link">Source</a></p><div class="doc"><p>Returns the first element of a sequence.
Calls <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#v:fail">fail</a></code> if the sequence is empty.
</p><p><em>Axioms:</em>
</p><ul><li><pre>lheadM empty = fail</pre></li><li><pre>lheadM (lcons x xs) = return x</pre></li></ul><p>This function is always <em>unambiguous</em>.
</p><p>Default running time: <code>O( 1 )</code>
</p></div><p class="src"><a name="v:ltail" class="def">ltail</a> :: s a -> s a<a href="src/Data-Edison-Seq.html#ltail" class="link">Source</a></p><div class="doc"><p>Delete the first element of the sequence.
Signals error if sequence is empty.
</p><p><em>Axioms:</em>
</p><ul><li><pre>ltail empty = undefined</pre></li><li><pre>ltail (lcons x xs) = xs</pre></li></ul><p>This function is always <em>unambiguous</em>.
</p><p>Default running time: <code>O( 1 )</code>
</p></div><p class="src"><a name="v:ltailM" class="def">ltailM</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m => s a -> m (s a)<a href="src/Data-Edison-Seq.html#ltailM" class="link">Source</a></p><div class="doc"><p>Delete the first element of the sequence.
Calls <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#v:fail">fail</a></code> if the sequence is empty.
</p><p><em>Axioms:</em>
</p><ul><li><pre>ltailM empty = fail</pre></li><li><pre>ltailM (lcons x xs) = return xs</pre></li></ul><p>This function is always <em>unambiguous</em>.
</p><p>Default running time: <code>O( 1 )</code>
</p></div><p class="src"><a name="v:rview" class="def">rview</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m => s a -> m (a, s a)<a href="src/Data-Edison-Seq.html#rview" class="link">Source</a></p><div class="doc"><p>Separate a sequence into its last (rightmost) element and the
remaining sequence. Calls <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#v:fail">fail</a></code> if the sequence is empty.
</p><p><em>Axioms:</em>
</p><ul><li><pre>rview empty = fail</pre></li><li><pre>rview (rcons x xs) = return (x,xs)</pre></li></ul><p>This function is always <em>unambiguous</em>.
</p><p>Default running time: <code>O( n )</code>
</p></div><p class="src"><a name="v:rhead" class="def">rhead</a> :: s a -> a<a href="src/Data-Edison-Seq.html#rhead" class="link">Source</a></p><div class="doc"><p>Return the last (rightmost) element of the sequence.
Signals error if sequence is empty.
</p><p><em>Axioms:</em>
</p><ul><li><pre>rhead empty = undefined</pre></li><li><pre>rhead (rcons x xs) = x</pre></li></ul><p>This function is always <em>unambiguous</em>.
</p><p>Default running time: <code>O( n )</code>
</p></div><p class="src"><a name="v:rheadM" class="def">rheadM</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m => s a -> m a<a href="src/Data-Edison-Seq.html#rheadM" class="link">Source</a></p><div class="doc"><p>Returns the last element of the sequence.
Calls <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#v:fail">fail</a></code> if the sequence is empty.
</p><p><em>Axioms:</em>
</p><ul><li><pre>rheadM empty = fail</pre></li><li><pre>rheadM (rcons x xs) = return x</pre></li></ul><p>This function is always <em>unambiguous</em>.
</p><p>Default running time: <code>O( n )</code>
</p></div><p class="src"><a name="v:rtail" class="def">rtail</a> :: s a -> s a<a href="src/Data-Edison-Seq.html#rtail" class="link">Source</a></p><div class="doc"><p>Delete the last (rightmost) element of the sequence.
Signals an error if the sequence is empty.
</p><p><em>Axioms:</em>
</p><ul><li><pre>rtail empty = undefined</pre></li><li><pre>rtail (rcons x xs) = xs</pre></li></ul><p>This function is always <em>unambiguous</em>.
</p><p>Default running time: <code>O( n )</code>
</p></div><p class="src"><a name="v:rtailM" class="def">rtailM</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m => s a -> m (s a)<a href="src/Data-Edison-Seq.html#rtailM" class="link">Source</a></p><div class="doc"><p>Delete the last (rightmost) element of the sequence.
Calls <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#v:fail">fail</a></code> of the sequence is empty
</p><p><em>Axioms:</em>
</p><ul><li><pre>rtailM empty = fail</pre></li><li><pre>rtailM (rcons x xs) = return xs</pre></li></ul><p>This function is always <em>unambiguous</em>.
</p><p>Default running time: <code>O( n )</code>
</p></div><p class="src"><a name="v:null" class="def">null</a> :: s a -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a><a href="src/Data-Edison-Seq.html#null" class="link">Source</a></p><div class="doc"><p>Returns <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Bool.html#v:True">True</a></code> if the sequence is empty and <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Bool.html#v:False">False</a></code> otherwise.
</p><pre> null <x0,...,xn-1> = (n==0)
</pre><p><em>Axioms:</em>
</p><ul><li><pre>null xs = (size xs == 0)</pre></li></ul><p>This function is always <em>unambiguous</em>.
</p><p>Default running time: <code>O( 1 )</code>
</p></div><p class="src"><a name="v:size" class="def">size</a> :: s a -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a><a href="src/Data-Edison-Seq.html#size" class="link">Source</a></p><div class="doc"><p>Returns the length of a sequence.
</p><pre> size <x0,...,xn-1> = n
</pre><p><em>Axioms:</em>
</p><ul><li><pre>size empty = 0</pre></li><li><pre>size (lcons x xs) = 1 + size xs</pre></li></ul><p>This function is always <em>unambiguous</em>.
</p><p>Default running time: <code>O( n )</code>
</p></div><p class="src"><a name="v:toList" class="def">toList</a> :: s a -> [a]<a href="src/Data-Edison-Seq.html#toList" class="link">Source</a></p><div class="doc"><p>Convert a sequence to a list.
</p><pre> toList <x0,...,xn-1> = [x0,...,xn-1]
</pre><p><em>Axioms:</em>
</p><ul><li><pre>toList empty = []</pre></li><li><pre>toList (lcons x xs) = x : toList xs</pre></li></ul><p>This function is always <em>unambiguous</em>.
</p><p>Default running time: <code>O( n )</code>
</p></div><p class="src"><a name="v:concat" class="def">concat</a> :: s (s a) -> s a<a href="src/Data-Edison-Seq.html#concat" class="link">Source</a></p><div class="doc"><p>Flatten a sequence of sequences into a simple sequence.
</p><pre> concat xss = foldr append empty xss
</pre><p><em>Axioms:</em>
</p><ul><li><pre>concat xss = foldr append empty xss</pre></li></ul><p>This function is always <em>unambiguous</em>.
</p><p>Default running time: <code>O( n + m )</code>
where <code>n</code> is the length of the input sequence and <code>m</code> is
length of the output sequence.
</p></div><p class="src"><a name="v:reverse" class="def">reverse</a> :: s a -> s a<a href="src/Data-Edison-Seq.html#reverse" class="link">Source</a></p><div class="doc"><p>Reverse the order of a sequence
</p><pre> reverse <x0,...,xn-1> = <xn-1,...,x0>
</pre><p><em>Axioms:</em>
</p><ul><li><pre>reverse empty = empty</pre></li><li><pre>reverse (lcons x xs) = rcons x (reverse xs)</pre></li></ul><p>This function is always <em>unambiguous</em>.
</p><p>Default running time: <code>O( n )</code>
</p></div><p class="src"><a name="v:reverseOnto" class="def">reverseOnto</a> :: s a -> s a -> s a<a href="src/Data-Edison-Seq.html#reverseOnto" class="link">Source</a></p><div class="doc"><p>Reverse a sequence onto the front of another sequence.
</p><pre> reverseOnto <x0,...,xn-1> <y0,...,ym-1> = <xn-1,...,x0,y0,...,ym-1>
</pre><p><em>Axioms:</em>
</p><ul><li><pre>reverseOnto xs ys = append (reverse xs) ys</pre></li></ul><p>This function is always <em>unambiguous</em>.
</p><p>Default running time: <code>O( n1 )</code>
</p></div><p class="src"><a name="v:fold" class="def">fold</a> :: (a -> b -> b) -> b -> s a -> b<a href="src/Data-Edison-Seq.html#fold" class="link">Source</a></p><div class="doc"><p>Combine all the elements of a sequence into a single value,
given a combining function and an initial value. The order
in which the elements are applied to the combining function
is unspecified. <code>fold</code> is one of the few ambiguous sequence
functions.
</p><p><em>Axioms:</em>
</p><ul><li><pre>fold f c empty = c</pre></li><li><pre>f is fold-commutative ==> fold f = foldr f = foldl f</pre></li></ul><p><code>fold f</code> is <em>unambiguous</em> iff <code>f</code> is fold-commutative.
</p><p>Default running type: <code>O( t * n )</code>
where <code>t</code> is the running tome of <code>f</code>.
</p></div><p class="src"><a name="v:fold-39-" class="def">fold'</a> :: (a -> b -> b) -> b -> s a -> b<a href="src/Data-Edison-Seq.html#fold%27" class="link">Source</a></p><div class="doc"><p>A strict variant of <code><a href="Data-Edison-Seq.html#v:fold">fold</a></code>. <code>fold'</code> is one of the few ambiguous
sequence functions.
</p><p><em>Axioms:</em>
</p><ul><li><pre>forall a. f a _|_ = _|_ ==> fold f x xs = fold' f x xs</pre></li></ul><p><code>fold f</code> is <em>unambiguous</em> iff <code>f</code> is fold-commutative.
</p><p>Default running type: <code>O( t * n )</code>
where <code>t</code> is the running tome of <code>f</code>.
</p></div><p class="src"><a name="v:fold1" class="def">fold1</a> :: (a -> a -> a) -> s a -> a<a href="src/Data-Edison-Seq.html#fold1" class="link">Source</a></p><div class="doc"><p>Combine all the elements of a non-empty sequence into a
single value, given a combining function. Signals an error
if the sequence is empty.
</p><p><em>Axioms:</em>
</p><ul><li><pre>f is fold-commutative ==> fold1 f = foldr1 f = foldl1 f</pre></li></ul><p><code>fold1 f</code> is <em>unambiguous</em> iff <code>f</code> is fold-commutative.
</p><p>Default running type: <code>O( t * n )</code>
where <code>t</code> is the running tome of <code>f</code>.
</p></div><p class="src"><a name="v:fold1-39-" class="def">fold1'</a> :: (a -> a -> a) -> s a -> a<a href="src/Data-Edison-Seq.html#fold1%27" class="link">Source</a></p><div class="doc"><p>A strict variant of <code><a href="Data-Edison-Seq.html#v:fold1">fold1</a></code>.
</p><p><em>Axioms:</em>
</p><ul><li><pre>forall a. f a _|_ = _|_ ==> fold1' f xs = fold1 f xs</pre></li></ul><p><code>fold1' f</code> is <em>unambiguous</em> iff <code>f</code> is fold-commutative.
</p><p>Default running time: <code>O( t * n )</code>
where <code>t</code> is the running time of <code>f</code>
</p></div><p class="src"><a name="v:foldr" class="def">foldr</a> :: (a -> b -> b) -> b -> s a -> b<a href="src/Data-Edison-Seq.html#foldr" class="link">Source</a></p><div class="doc"><p>Combine all the elements of a sequence into a single value,
given a combining function and an initial value. The function
is applied with right nesting.
</p><pre> foldr (%) c <x0,...,xn-1> = x0 % (x1 % ( ... % (xn-1 % c)))
</pre><p><em>Axioms:</em>
</p><ul><li><pre>foldr f c empty = c</pre></li><li><pre>foldr f c (lcons x xs) = f x (foldr f c xs)</pre></li></ul><p>This function is always <em>unambiguous</em>.
</p><p>Default running time: <code>O( t * n )</code>
where <code>t</code> is the running time of <code>f</code>
</p></div><p class="src"><a name="v:foldr-39-" class="def">foldr'</a> :: (a -> b -> b) -> b -> s a -> b<a href="src/Data-Edison-Seq.html#foldr%27" class="link">Source</a></p><div class="doc"><p>Strict variant of <code><a href="Data-Edison-Seq.html#v:foldr">foldr</a></code>.
</p><p><em>Axioms:</em>
</p><ul><li><pre>forall a. f a _|_ = _|_ ==> foldr f x xs = foldr' f x xs</pre></li></ul><p>This function is always <em>unambiguous</em>.
</p><p>Default running time: <code>O( t * n )</code>
where <code>t</code> is the running time of <code>f</code>
</p></div><p class="src"><a name="v:foldl" class="def">foldl</a> :: (b -> a -> b) -> b -> s a -> b<a href="src/Data-Edison-Seq.html#foldl" class="link">Source</a></p><div class="doc"><p>Combine all the elements of a sequence into a single value,
given a combining function and an initial value. The function
is applied with left nesting.
</p><pre> foldl (%) c <x0,...,xn-1> = (((c % x0) % x1) % ... ) % xn-1
</pre><p><em>Axioms:</em>
</p><ul><li><pre>foldl f c empty = c</pre></li><li><pre>foldl f c (lcons x xs) = foldl f (f c x) xs</pre></li></ul><p>This function is always <em>unambiguous</em>.
</p><p>Default running time: <code>O( t * n )</code>
where <code>t</code> is the running time of <code>f</code>
</p></div><p class="src"><a name="v:foldl-39-" class="def">foldl'</a> :: (b -> a -> b) -> b -> s a -> b<a href="src/Data-Edison-Seq.html#foldl%27" class="link">Source</a></p><div class="doc"><p>Strict variant of <code><a href="Data-Edison-Seq.html#v:foldl">foldl</a></code>.
</p><p><em>Axioms:</em>
</p><ul><li> forall a. f _|_ a = _|_ ==> foldl f z xs = foldl' f z xs
</li></ul><p>This function is always <em>unambiguous</em>.
</p><p>Default running time: <code>O( t * n )</code>
where <code>t</code> is the running time of <code>f</code>
</p></div><p class="src"><a name="v:foldr1" class="def">foldr1</a> :: (a -> a -> a) -> s a -> a<a href="src/Data-Edison-Seq.html#foldr1" class="link">Source</a></p><div class="doc"><p>Combine all the elements of a non-empty sequence into a
single value, given a combining function. The function
is applied with right nesting. Signals an error if the
sequence is empty.
</p><pre> foldr1 (+) <x0,...,xn-1>
| n==0 = error "ModuleName.foldr1: empty sequence"
| n>0 = x0 + (x1 + ... + xn-1)
</pre><p><em>Axioms:</em>
</p><ul><li><pre>foldr1 f empty = undefined</pre></li><li><pre>foldr1 f (rcons x xs) = foldr f x xs</pre></li></ul><p>This function is always <em>unambiguous</em>.
</p><p>Default running time: <code>O( t * n )</code>
where <code>t</code> is the running time of <code>f</code>
</p></div><p class="src"><a name="v:foldr1-39-" class="def">foldr1'</a> :: (a -> a -> a) -> s a -> a<a href="src/Data-Edison-Seq.html#foldr1%27" class="link">Source</a></p><div class="doc"><p>Strict variant of <code><a href="Data-Edison-Seq.html#v:foldr1">foldr1</a></code>.
</p><p><em>Axioms:</em>
</p><ul><li> forall a. f a _|_ = _|_ ==> foldr1 f xs = foldr1' f xs
</li></ul><p>This function is always <em>unambiguous</em>.
</p><p>Default running time: <code>O( t * n )</code>
where <code>t</code> is the running time of <code>f</code>
</p></div><p class="src"><a name="v:foldl1" class="def">foldl1</a> :: (a -> a -> a) -> s a -> a<a href="src/Data-Edison-Seq.html#foldl1" class="link">Source</a></p><div class="doc"><p>Combine all the elements of a non-empty sequence into
a single value, given a combining function. The function
is applied with left nesting. Signals an error if the
sequence is empty.
</p><pre> foldl1 (+) <x0,...,xn-1>
| n==0 = error "ModuleName.foldl1: empty sequence"
| n>0 = (x0 + x1) + ... + xn-1
</pre><p><em>Axioms:</em>
</p><ul><li><pre>foldl1 f empty = undefined</pre></li><li><pre>foldl1 f (lcons x xs) = foldl f x xs</pre></li></ul><p>This function is always <em>unambiguous</em>.
</p><p>Default running time: <code>O( t * n )</code>
where <code>t</code> is the running time of <code>f</code>
</p></div><p class="src"><a name="v:foldl1-39-" class="def">foldl1'</a> :: (a -> a -> a) -> s a -> a<a href="src/Data-Edison-Seq.html#foldl1%27" class="link">Source</a></p><div class="doc"><p>Strict variant of <code><a href="Data-Edison-Seq.html#v:foldl1">foldl1</a></code>.
</p><p><em>Axioms:</em>
</p><ul><li> forall a. f _|_ a = _|_ ==> foldl1 f xs = foldl1' f xs
</li></ul><p>This function is always <em>unambiguous</em>.
</p><p>Default running time: <code>O( t * n )</code>
where <code>t</code> is the running time of <code>f</code>
</p></div><p class="src"><a name="v:reducer" class="def">reducer</a> :: (a -> a -> a) -> a -> s a -> a<a href="src/Data-Edison-Seq.html#reducer" class="link">Source</a></p><div class="doc"><p>See <code><a href="Data-Edison-Seq.html#v:reduce1">reduce1</a></code> for additional notes.
</p><pre> reducer f x xs = reduce1 f (cons x xs)
</pre><p><em>Axioms:</em>
</p><ul><li> <code>reducer f c xs = foldr f c xs</code> for associative <code>f</code>
</li></ul><p><code>reducer f</code> is unambiguous iff <code>f</code> is an associative function.
</p><p>Default running time: <code>O( t * n )</code>
where <code>t</code> is the running time of <code>f</code>
</p></div><p class="src"><a name="v:reducer-39-" class="def">reducer'</a> :: (a -> a -> a) -> a -> s a -> a<a href="src/Data-Edison-Seq.html#reducer%27" class="link">Source</a></p><div class="doc"><p>Strict variant of <code><a href="Data-Edison-Seq.html#v:reducer">reducer</a></code>.
</p><p>See <code><a href="Data-Edison-Seq.html#v:reduce1">reduce1</a></code> for additional notes.
</p><p><em>Axioms:</em>
</p><ul><li><pre>forall a. f a _|_ = _|_ && forall a. f _|_ a = _|_ ==>
reducer f x xs = reducer' f x xs</pre></li></ul><p><code>reducer' f</code> is unambiguous iff <code>f</code> is an associative function.
</p><p>Default running time: <code>O( t * n )</code>
where <code>t</code> is the running time of <code>f</code>
</p></div><p class="src"><a name="v:reducel" class="def">reducel</a> :: (a -> a -> a) -> a -> s a -> a<a href="src/Data-Edison-Seq.html#reducel" class="link">Source</a></p><div class="doc"><p>See <code><a href="Data-Edison-Seq.html#v:reduce1">reduce1</a></code> for additional notes.
</p><pre> reducel f x xs = reduce1 f (rcons x xs)
</pre><p><em>Axioms:</em>
</p><ul><li> <code>reducel f c xs = foldl f c xs</code> for associative <code>f</code>
</li></ul><p><code>reducel f</code> is unambiguous iff <code>f</code> is an associative function.
</p><p>Default running time: <code>O( t * n )</code>
where <code>t</code> is the running time of <code>f</code>
</p></div><p class="src"><a name="v:reducel-39-" class="def">reducel'</a> :: (a -> a -> a) -> a -> s a -> a<a href="src/Data-Edison-Seq.html#reducel%27" class="link">Source</a></p><div class="doc"><p>Strict variant of <code><a href="Data-Edison-Seq.html#v:reducel">reducel</a></code>.
</p><p>See <code><a href="Data-Edison-Seq.html#v:reduce1">reduce1</a></code> for additional notes.
</p><p><em>Axioms:</em>
</p><ul><li><pre>forall a. f a _|_ = _|_ && forall a. f _|_ a = _|_ ==>
reducel f x xs = reducel' f x xs</pre></li></ul><p><code>reducel' f</code> is unambiguous iff <code>f</code> is an associative function.
</p><p>Default running time: <code>O( t * n )</code>
where <code>t</code> is the running time of <code>f</code>
</p></div><p class="src"><a name="v:reduce1" class="def">reduce1</a> :: (a -> a -> a) -> s a -> a<a href="src/Data-Edison-Seq.html#reduce1" class="link">Source</a></p><div class="doc"><p>A reduce is similar to a fold, but combines elements in a balanced fashion.
The combining function should usually be associative. If the combining
function is associative, the various reduce functions yield the same
results as the corresponding folds.
</p><p>What is meant by "in a balanced fashion"? We mean that
<code>reduce1 (%) <x0,x1,...,xn-1></code> equals some complete parenthesization of
<code>x0 % x1 % ... % xn-1</code> such that the nesting depth of parentheses
is <code>O( log n )</code>. The precise shape of this parenthesization is
unspecified.
</p><pre> reduce1 f <x> = x
reduce1 f <x0,...,xn-1> =
f (reduce1 f <x0,...,xi>) (reduce1 f <xi+1,...,xn-1>)
</pre><p>for some <code>i</code> such that <code> 0 <= i && i < n-1 </code>
</p><p>Although the exact value of i is unspecified it tends toward <code>n/2</code>
so that the depth of calls to <code>f</code> is at most logarithmic.
</p><p>Note that <code>reduce</code>* are some of the only sequence operations for which
different implementations are permitted to yield different answers. Also
note that a single implementation may choose different parenthisizations
for different sequences, even if they are the same length. This will
typically happen when the sequences were constructed differently.
</p><p>The canonical applications of the reduce functions are algorithms like
merge sort where:
</p><pre> mergesort xs = reducer merge empty (map singleton xs)
</pre><p><em>Axioms:</em>
</p><ul><li><pre>reduce1 f empty = undefined</pre></li><li> <code>reduce1 f xs = foldr1 f xs = foldl1 f xs</code> for associative <code>f</code>
</li></ul><p><code>reduce1 f</code> is unambiguous iff <code>f</code> is an associative function.
</p><p>Default running time: <code>O( t * n )</code>
where <code>t</code> is the running time of <code>f</code>
</p></div><p class="src"><a name="v:reduce1-39-" class="def">reduce1'</a> :: (a -> a -> a) -> s a -> a<a href="src/Data-Edison-Seq.html#reduce1%27" class="link">Source</a></p><div class="doc"><p>Strict variant of <code><a href="Data-Edison-Seq.html#v:reduce1">reduce1</a></code>.
</p><p><em>Axioms:</em>
</p><ul><li><pre>forall a. f a _|_ = _|_ && forall a. f _|_ a = _|_ ==>
reduce1 f xs = reduce1' f xs</pre></li></ul><p><code>reduce1' f</code> is unambiguous iff <code>f</code> is an associative function.
</p><p>Default running time: <code>O( t * n )</code>
where <code>t</code> is the running time of <code>f</code>
</p></div><p class="src"><a name="v:take" class="def">take</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -> s a -> s a<a href="src/Data-Edison-Seq.html#take" class="link">Source</a></p><div class="doc"><p>Extract a prefix of length <code>i</code> from the sequence. Return
<code><a href="Data-Edison-Seq.html#v:empty">empty</a></code> if <code>i</code> is negative, or the entire sequence if <code>i</code>
is too large.
</p><pre> take i xs = fst (splitAt i xs)
</pre><p><em>Axioms:</em>
</p><ul><li><pre>i < 0 ==> take i xs = empty</pre></li><li><pre>i > size xs ==> take i xs = xs</pre></li><li><pre>size xs == i ==> take i (append xs ys) = xs</pre></li></ul><p>This function is always <em>unambiguous</em>.
</p><p>Default running time: <code>O( i )</code>
</p></div><p class="src"><a name="v:drop" class="def">drop</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -> s a -> s a<a href="src/Data-Edison-Seq.html#drop" class="link">Source</a></p><div class="doc"><p>Delete a prefix of length <code>i</code> from a sequence. Return
the entire sequence if <code>i</code> is negative, or <code><a href="Data-Edison-Seq.html#v:empty">empty</a></code> if
<code>i</code> is too large.
</p><pre> drop i xs = snd (splitAt i xs)
</pre><p><em>Axioms:</em>
</p><ul><li><pre>i < 0 ==> drop i xs = xs</pre></li><li><pre>i > size xs ==> drop i xs = empty</pre></li><li><pre>size xs == i ==> drop i (append xs ys) = ys</pre></li></ul><p>This function is always <em>unambiguous</em>.
</p><p>Default running time: <code>O( i )</code>
</p></div><p class="src"><a name="v:splitAt" class="def">splitAt</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -> s a -> (s a, s a)<a href="src/Data-Edison-Seq.html#splitAt" class="link">Source</a></p><div class="doc"><p>Split a sequence into a prefix of length <code>i</code>
and the remaining sequence. Behaves the same
as the corresponding calls to <code><a href="Data-Edison-Seq.html#v:take">take</a></code> and <code><a href="Data-Edison-Seq.html#v:drop">drop</a></code>
if <code>i</code> is negative or too large.
</p><pre> splitAt i xs
| i < 0 = (<> , <x0,...,xn-1>)
| i < n = (<x0,...,xi-1>, <xi,...,xn-1>)
| i >= n = (<x0,...,xn-1>, <> )
</pre><p><em>Axioms:</em>
</p><ul><li><pre>splitAt i xs = (take i xs,drop i xs)</pre></li></ul><p>This function is always <em>unambiguous</em>.
</p><p>Default running time: <code>O( i )</code>
</p></div><p class="src"><a name="v:subseq" class="def">subseq</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -> s a -> s a<a href="src/Data-Edison-Seq.html#subseq" class="link">Source</a></p><div class="doc"><p>Extract a subsequence from a sequence. The integer
arguments are "start index" and "length" NOT
"start index" and "end index". Behaves the same
as the corresponding calls to <code><a href="Data-Edison-Seq.html#v:take">take</a></code> and <code><a href="Data-Edison-Seq.html#v:drop">drop</a></code> if the
start index or length are negative or too large.
</p><pre> subseq i len xs = take len (drop i xs)
</pre><p><em>Axioms:</em>
</p><ul><li><pre>subseq i len xs = take len (drop i xs)</pre></li></ul><p>This function is always <em>unambiguous</em>.
</p><p>Default running time: <code>O( i + len )</code>
</p></div><p class="src"><a name="v:filter" class="def">filter</a> :: (a -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a>) -> s a -> s a<a href="src/Data-Edison-Seq.html#filter" class="link">Source</a></p><div class="doc"><p>Extract the elements of a sequence that satisfy the
given predicate, retaining the relative ordering of
elements from the original sequence.
</p><pre> filter p xs = foldr pcons empty xs
where pcons x xs = if p x then cons x xs else xs
</pre><p><em>Axioms:</em>
</p><ul><li><pre>filter p empty = empty</pre></li><li><pre>filter p (lcons x xs) = if p x
then lcons x (filter p xs)
else filter p xs</pre></li></ul><p>This function is always <em>unambiguous</em>.
</p><p>Default running time: <code>O( t * n )</code>
where <code>t</code> is the running time of <code>p</code>
</p></div><p class="src"><a name="v:partition" class="def">partition</a> :: (a -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a>) -> s a -> (s a, s a)<a href="src/Data-Edison-Seq.html#partition" class="link">Source</a></p><div class="doc"><p>Separate the elements of a sequence into those that
satisfy the given predicate and those that do not,
retaining the relative ordering of elements from the
original sequence.
</p><pre> partition p xs = (filter p xs, filter (not . p) xs)
</pre><p><em>Axioms:</em>
</p><ul><li><pre>partition p xs = (filter p xs, filter (not . p) xs)</pre></li></ul><p>This function is always <em>unambiguous</em>.
</p><p>Default running time: <code>O( t * n )</code>
where <code>t</code> is the running time of <code>p</code>
</p></div><p class="src"><a name="v:takeWhile" class="def">takeWhile</a> :: (a -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a>) -> s a -> s a<a href="src/Data-Edison-Seq.html#takeWhile" class="link">Source</a></p><div class="doc"><p>Extract the maximal prefix of elements satisfying the
given predicate.
</p><pre> takeWhile p xs = fst (splitWhile p xs)
</pre><p><em>Axioms:</em>
</p><ul><li><pre>takeWhile p empty = empty</pre></li><li><pre>takeWhile p (lcons x xs) = if p x
then lcons x (takeWhile p xs)
else empty</pre></li></ul><p>This function is always <em>unambiguous</em>.
</p><p>Default running time: <code>O( t * n )</code>
where <code>t</code> is the running time of <code>p</code>
</p></div><p class="src"><a name="v:dropWhile" class="def">dropWhile</a> :: (a -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a>) -> s a -> s a<a href="src/Data-Edison-Seq.html#dropWhile" class="link">Source</a></p><div class="doc"><p>Delete the maximal prefix of elements satisfying the
given predicate.
</p><pre> dropWhile p xs = snd (splitWhile p xs)
</pre><p><em>Axioms:</em>
</p><ul><li><pre>dropWhile p empty = empty</pre></li><li><pre>dropWhile p (lcons x xs) = if p x
then dropWhile p xs
else lcons x xs</pre></li></ul><p>This function is always <em>unambiguous</em>.
</p><p>Default running time: <code>O( t * n )</code>
where <code>t</code> is the running time of <code>p</code>
</p></div><p class="src"><a name="v:splitWhile" class="def">splitWhile</a> :: (a -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a>) -> s a -> (s a, s a)<a href="src/Data-Edison-Seq.html#splitWhile" class="link">Source</a></p><div class="doc"><p>Split a sequence into the maximal prefix of elements
satisfying the given predicate, and the remaining sequence.
</p><pre> splitWhile p <x0,...,xn-1> = (<x0,...,xi-1>, <xi,...,xn-1>)
where i = min j such that p xj (or n if no such j)
</pre><p><em>Axioms:</em>
</p><ul><li><pre>splitWhile p xs = (takeWhile p xs,dropWhile p xs)</pre></li></ul><p>This function is always <em>unambiguous</em>.
</p><p>Default running time: <code>O( t * n )</code>
where <code>t</code> is the running time of <code>p</code>
</p></div><p class="src"><a name="v:inBounds" class="def">inBounds</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -> s a -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a><a href="src/Data-Edison-Seq.html#inBounds" class="link">Source</a></p><div class="doc"><p>Test whether an index is valid for the given sequence. All indexes
are 0 based.
</p><pre> inBounds i <x0,...,xn-1> = (0 <= i && i < n)
</pre><p><em>Axioms:</em>
</p><ul><li><pre>inBounds i xs = (0 <= i && i < size xs)</pre></li></ul><p>This function is always <em>unambiguous</em>.
</p><p>Default running time: <code>O( i )</code>
</p></div><p class="src"><a name="v:lookup" class="def">lookup</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -> s a -> a<a href="src/Data-Edison-Seq.html#lookup" class="link">Source</a></p><div class="doc"><p>Return the element at the given index. All indexes are 0 based.
Signals error if the index out of bounds.
</p><pre> lookup i xs@<x0,...,xn-1>
| inBounds i xs = xi
| otherwise = error "ModuleName.lookup: index out of bounds"
</pre><p><em>Axioms:</em>
</p><ul><li><pre>not (inBounds i xs) ==> lookup i xs = undefined</pre></li><li><pre>size xs == i ==> lookup i (append xs (lcons x ys)) = x</pre></li></ul><p>This function is always <em>unambiguous</em>.
</p><p>Default running time: <code>O( i )</code>
</p></div><p class="src"><a name="v:lookupM" class="def">lookupM</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m => <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -> s a -> m a<a href="src/Data-Edison-Seq.html#lookupM" class="link">Source</a></p><div class="doc"><p>Return the element at the given index. All indexes are 0 based.
Calls <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Control-Monad.html#v:fail">fail</a></code> if the index is out of bounds.
</p><pre> lookupM i xs@<x0,...,xn-1>
| inBounds i xs = Just xi
| otherwise = Nothing
</pre><p><em>Axioms:</em>
</p><ul><li><pre>not (inBounds i xs) ==> lookupM i xs = fail</pre></li><li><pre>size xs == i ==> lookupM i (append xs (lcons x ys)) = return x</pre></li></ul><p>This function is always <em>unambiguous</em>.
</p><p>Default running time: <code>O( i )</code>
</p></div><p class="src"><a name="v:lookupWithDefault" class="def">lookupWithDefault</a> :: a -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -> s a -> a<a href="src/Data-Edison-Seq.html#lookupWithDefault" class="link">Source</a></p><div class="doc"><p>Return the element at the given index, or the
default argument if the index is out of bounds. All indexes are
0 based.
</p><pre> lookupWithDefault d i xs@<x0,...,xn-1>
| inBounds i xs = xi
| otherwise = d
</pre><p><em>Axioms:</em>
</p><ul><li><pre>not (inBounds i xs) ==> lookupWithDefault d i xs = d</pre></li><li><pre>size xs == i ==> lookupWithDefault d i (append xs (lcons x ys)) = x</pre></li></ul><p>This function is always <em>unambiguous</em>.
</p><p>Default running time: <code>O( i )</code>
</p></div><p class="src"><a name="v:update" class="def">update</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -> a -> s a -> s a<a href="src/Data-Edison-Seq.html#update" class="link">Source</a></p><div class="doc"><p>Replace the element at the given index, or return
the original sequence if the index is out of bounds.
All indexes are 0 based.
</p><pre> update i y xs@<x0,...,xn-1>
| inBounds i xs = <x0,...xi-1,y,xi+1,...,xn-1>
| otherwise = xs
</pre><p><em>Axioms:</em>
</p><ul><li><pre>not (inBounds i xs) ==> update i y xs = xs</pre></li><li><pre>size xs == i ==> update i y (append xs (lcons x ys)) =
append xs (lcons y ys)</pre></li></ul><p>This function is always <em>unambiguous</em>.
</p><p>Default running time: <code>O( i )</code>
</p></div><p class="src"><a name="v:adjust" class="def">adjust</a> :: (a -> a) -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -> s a -> s a<a href="src/Data-Edison-Seq.html#adjust" class="link">Source</a></p><div class="doc"><p>Apply a function to the element at the given index, or
return the original sequence if the index is out of bounds.
All indexes are 0 based.
</p><pre> adjust f i xs@<x0,...,xn-1>
| inBounds i xs = <x0,...xi-1,f xi,xi+1,...,xn-1>
| otherwise = xs
</pre><p><em>Axioms:</em>
</p><ul><li><pre>not (inBounds i xs) ==> adjust f i xs = xs</pre></li><li><pre>size xs == i ==> adjust f i (append xs (lcons x ys)) =
append xs (cons (f x) ys)</pre></li></ul><p>This function is always <em>unambiguous</em>.
</p><p>Default running time: <code>O( i + t )</code>
where <code>t</code> is the running time of <code>f</code>
</p></div><p class="src"><a name="v:mapWithIndex" class="def">mapWithIndex</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -> a -> b) -> s a -> s b<a href="src/Data-Edison-Seq.html#mapWithIndex" class="link">Source</a></p><div class="doc"><p>Like <code><a href="Data-Edison-Seq.html#v:map">map</a></code>, but include the index with each element.
All indexes are 0 based.
</p><pre> mapWithIndex f <x0,...,xn-1> = <f 0 x0,...,f (n-1) xn-1>
</pre><p><em>Axioms:</em>
</p><ul><li><pre>mapWithIndex f empty = empty</pre></li><li><pre>mapWithIndex f (rcons x xs) = rcons (f (size xs) x) (mapWithIndex f xs)</pre></li></ul><p>This function is always <em>unambiguous</em>.
</p><p>Default running time: <code>O( t * n )</code>
where <code>t</code> is the running time of <code>f</code>
</p></div><p class="src"><a name="v:foldrWithIndex" class="def">foldrWithIndex</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -> a -> b -> b) -> b -> s a -> b<a href="src/Data-Edison-Seq.html#foldrWithIndex" class="link">Source</a></p><div class="doc"><p>Like <code><a href="Data-Edison-Seq.html#v:foldr">foldr</a></code>, but include the index with each element.
All indexes are 0 based.
</p><pre> foldrWithIndex f c <x0,...,xn-1> =
f 0 x0 (f 1 x1 (... (f (n-1) xn-1 c)))
</pre><p><em>Axioms:</em>
</p><ul><li><pre>foldrWithIndex f c empty = c</pre></li><li><pre>foldrWithIndex f c (rcons x xs) =
foldrWithIndex f (f (size xs) x c) xs</pre></li></ul><p>This function is always <em>unambiguous</em>.
</p><p>Default running time: <code>O( t * n )</code>
where <code>t</code> is the running time of <code>f</code>
</p></div><p class="src"><a name="v:foldrWithIndex-39-" class="def">foldrWithIndex'</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -> a -> b -> b) -> b -> s a -> b<a href="src/Data-Edison-Seq.html#foldrWithIndex%27" class="link">Source</a></p><div class="doc"><p>Strict variant of <code><a href="Data-Edison-Seq.html#v:foldrWithIndex">foldrWithIndex</a></code>.
</p><p><em>Axioms:</em>
</p><ul><li><pre>forall i a. f i a _|_ = _|_ ==> foldrWithIndex f x xs =
foldrWithIndex' f x xs</pre></li></ul><p>This function is always <em>unambiguous</em>.
</p><p>Default running time: <code>O( t * n )</code>
where <code>t</code> is the running time of <code>f</code>
</p></div><p class="src"><a name="v:foldlWithIndex" class="def">foldlWithIndex</a> :: (b -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -> a -> b) -> b -> s a -> b<a href="src/Data-Edison-Seq.html#foldlWithIndex" class="link">Source</a></p><div class="doc"><p>Like <code><a href="Data-Edison-Seq.html#v:foldl">foldl</a></code>, but include the index with each element.
All indexes are 0 based.
</p><pre> foldlWithIndex f c <x0,...,xn-1> =
f (...(f (f c 0 x0) 1 x1)...) (n-1) xn-1)
</pre><p><em>Axioms:</em>
</p><ul><li><pre>foldlWithIndex f c empty = c</pre></li><li><pre>foldlWithIndex f c (rcons x xs) =
f (foldlWithIndex f c xs) (size xs) x</pre></li></ul><p>This function is always <em>unambiguous</em>.
</p><p>Default running time: <code>O( t * n )</code>
where <code>t</code> is the running time of <code>f</code>
</p></div><p class="src"><a name="v:foldlWithIndex-39-" class="def">foldlWithIndex'</a> :: (b -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> -> a -> b) -> b -> s a -> b<a href="src/Data-Edison-Seq.html#foldlWithIndex%27" class="link">Source</a></p><div class="doc"><p>Strict variant of <code><a href="Data-Edison-Seq.html#v:foldlWithIndex">foldlWithIndex</a></code>.
</p><p><em>Axioms:</em>
</p><ul><li><pre>forall i a. f _|_ i a = _|_ ==> foldlWithIndex f x xs =
foldlWithIndex' f x xs</pre></li></ul><p>This function is always <em>unambiguous</em>.
</p><p>Default running time: <code>O( t * n )</code>
where <code>t</code> is the running time of <code>f</code>
</p></div><p class="src"><a name="v:zip" class="def">zip</a> :: s a -> s b -> s (a, b)<a href="src/Data-Edison-Seq.html#zip" class="link">Source</a></p><div class="doc"><p>Combine two sequences into a sequence of pairs. If the
sequences are different lengths, the excess elements of the
longer sequence is discarded.
</p><pre> zip <x0,...,xn-1> <y0,...,ym-1> = <(x0,y0),...,(xj-1,yj-1)>
where j = min {n,m}
</pre><p><em>Axioms:</em>
</p><ul><li><pre>zip xs ys = zipWith (,) xs ys</pre></li></ul><p>This function is always <em>unambiguous</em>.
</p><p>Default running time: <code>O( min( n1, n2 ) )</code>
</p></div><p class="src"><a name="v:zip3" class="def">zip3</a> :: s a -> s b -> s c -> s (a, b, c)<a href="src/Data-Edison-Seq.html#zip3" class="link">Source</a></p><div class="doc"><p>Like <code><a href="Data-Edison-Seq.html#v:zip">zip</a></code>, but combines three sequences into triples.
</p><pre> zip3 <x0,...,xn-1> <y0,...,ym-1> <z0,...,zk-1> =
<(x0,y0,z0),...,(xj-1,yj-1,zj-1)>
where j = min {n,m,k}
</pre><p><em>Axioms:</em>
</p><ul><li><pre>zip3 xs ys zs = zipWith3 (,,) xs ys zs</pre></li></ul><p>This function is always <em>unambiguous</em>.
</p><p>Default running time: <code>O( min( n1, n2, n3 ) )</code>
</p></div><p class="src"><a name="v:zipWith" class="def">zipWith</a> :: (a -> b -> c) -> s a -> s b -> s c<a href="src/Data-Edison-Seq.html#zipWith" class="link">Source</a></p><div class="doc"><p>Combine two sequences into a single sequence by mapping
a combining function across corresponding elements. If
the sequences are of different lengths, the excess elements
of the longer sequence are discarded.
</p><pre> zipWith f xs ys = map (uncurry f) (zip xs ys)
</pre><p><em>Axioms:</em>
</p><ul><li><pre>zipWith f (lcons x xs) (lcons y ys) =
lcons (f x y) (zipWith f xs ys)</pre></li><li><pre>(null xs || null ys) ==> zipWith xs ys = empty</pre></li></ul><p>This function is always <em>unambiguous</em>.
</p><p>Default running time: <code>O( t * min( n1, n2 ) )</code>
where <code>t</code> is the running time of <code>f</code>
</p></div><p class="src"><a name="v:zipWith3" class="def">zipWith3</a> :: (a -> b -> c -> d) -> s a -> s b -> s c -> s d<a href="src/Data-Edison-Seq.html#zipWith3" class="link">Source</a></p><div class="doc"><p>Like <code><a href="Data-Edison-Seq.html#v:zipWith">zipWith</a></code> but for a three-place function and three
sequences.
</p><pre> zipWith3 f xs ys zs = map (uncurry f) (zip3 xs ys zs)
</pre><p><em>Axioms:</em>
</p><ul><li><pre>zipWith3 (lcons x xs) (lcons y ys) (lcons z zs) =
lcons (f x y z) (zipWith3 f xs ys zs)</pre></li></ul><p>This function is always <em>unambiguous</em>.
</p><p>Default running time: <code>O( t * min( n1, n2, n3 ) )</code>
where <code>t</code> is the running time of <code>f</code>
</p></div><p class="src"><a name="v:unzip" class="def">unzip</a> :: s (a, b) -> (s a, s b)<a href="src/Data-Edison-Seq.html#unzip" class="link">Source</a></p><div class="doc"><p>Transpose a sequence of pairs into a pair of sequences.
</p><pre> unzip xs = (map fst xs, map snd xs)
</pre><p><em>Axioms:</em>
</p><ul><li><pre>unzip xys = unzipWith fst snd xys</pre></li></ul><p>This function is always <em>unambiguous</em>.
</p><p>Default running time: <code>O( n )</code>
</p></div><p class="src"><a name="v:unzip3" class="def">unzip3</a> :: s (a, b, c) -> (s a, s b, s c)<a href="src/Data-Edison-Seq.html#unzip3" class="link">Source</a></p><div class="doc"><p>Transpose a sequence of triples into a triple of sequences
</p><pre> unzip3 xs = (map fst3 xs, map snd3 xs, map thd3 xs)
where fst3 (x,y,z) = x
snd3 (x,y,z) = y
thd3 (x,y,z) = z
</pre><p><em>Axioms:</em>
</p><ul><li><pre>unzip3 xyzs = unzipWith3 fst3 snd3 thd3 xyzs</pre></li></ul><p>This function is always <em>unambiguous</em>.
</p><p>Default running time: <code>O( n )</code>
</p></div><p class="src"><a name="v:unzipWith" class="def">unzipWith</a> :: (a -> b) -> (a -> c) -> s a -> (s b, s c)<a href="src/Data-Edison-Seq.html#unzipWith" class="link">Source</a></p><div class="doc"><p>Map two functions across every element of a sequence,
yielding a pair of sequences
</p><pre> unzipWith f g xs = (map f xs, map g xs)
</pre><p><em>Axioms:</em>
</p><ul><li><pre>unzipWith f g xs = (map f xs, map g xs)</pre></li></ul><p>This function is always <em>unambiguous</em>.
</p><p>Default running time: <code>O( t * n )</code>
where <code>t</code> is the maximum running time
of <code>f</code> and <code>g</code>
</p></div><p class="src"><a name="v:unzipWith3" class="def">unzipWith3</a> :: (a -> b) -> (a -> c) -> (a -> d) -> s a -> (s b, s c, s d)<a href="src/Data-Edison-Seq.html#unzipWith3" class="link">Source</a></p><div class="doc"><p>Map three functions across every element of a sequence,
yielding a triple of sequences.
</p><pre> unzipWith3 f g h xs = (map f xs, map g xs, map h xs)
</pre><p><em>Axioms:</em>
</p><ul><li><pre>unzipWith3 f g h xs = (map f xs,map g xs,map h xs)</pre></li></ul><p>This function is always <em>unambiguous</em>.
</p><p>Default running time: <code>O( t * n )</code>
where <code>t</code> is the maximum running time
of <code>f</code>, <code>g</code>, and <code>h</code>
</p></div><p class="src"><a name="v:strict" class="def">strict</a> :: s a -> s a<a href="src/Data-Edison-Seq.html#strict" class="link">Source</a></p><div class="doc"><p>Semanticly, this function is a partial identity function. If the
datastructure is infinite in size or contains exceptions or non-termination
in the structure itself, then <code>strict</code> will result in bottom. Operationally,
this function walks the datastructure forcing any closures. Elements contained
in the sequence are <em>not</em> forced.
</p><p><em>Axioms:</em>
</p><ul><li> <code>strict xs = xs</code> OR <code>strict xs = _|_</code>
</li></ul><p>This function is always <em>unambiguous</em>.
</p><p>Default running time: <code>O( n )</code>
</p></div><p class="src"><a name="v:strictWith" class="def">strictWith</a> :: (a -> b) -> s a -> s a<a href="src/Data-Edison-Seq.html#strictWith" class="link">Source</a></p><div class="doc"><p>Similar to <code><a href="Data-Edison-Seq.html#v:strict">strict</a></code>, this function walks the datastructure forcing closures.
However, <code>strictWith</code> will additionally apply the given function to the
sequence elements, force the result using <code>seq</code>, and then ignore it.
This function can be used to perform various levels of forcing on the
sequence elements. In particular:
</p><pre> strictWith id xs
</pre><p>will force the spine of the datastructure and reduce each element to WHNF.
</p><p><em>Axioms:</em>
</p><ul><li> forall <code>f :: a -> b</code>, <code>strictWith f xs = xs</code> OR <code>strictWith f xs = _|_</code>
</li></ul><p>This function is always <em>unambiguous</em>.
</p><p>Default running time: unbounded (forcing element closures can take arbitrairly long)
</p></div><p class="src"><a name="v:structuralInvariant" class="def">structuralInvariant</a> :: s a -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a><a href="src/Data-Edison-Seq.html#structuralInvariant" class="link">Source</a></p><div class="doc"><p>A method to facilitate unit testing. Returns <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Bool.html#v:True">True</a></code> if the structural
invariants of the implementation hold for the given sequence. If
this function returns <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Bool.html#v:False">False</a></code>, it represents a bug in the implementation.
</p></div><p class="src"><a name="v:instanceName" class="def">instanceName</a> :: s a -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a><a href="src/Data-Edison-Seq.html#instanceName" class="link">Source</a></p><div class="doc"><p>The name of the module implementing s.
</p></div></div><div class="subs instances"><p id="control.i:Sequence" class="caption collapser" onclick="toggleSection('i:Sequence')">Instances</p><div id="section.i:Sequence" class="show"><table><tr><td class="src"><a href="Data-Edison-Seq.html#t:Sequence">Sequence</a> []</td><td class="doc empty"> </td></tr></table></div></div></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.10.0</p></div></body></html>
|