/usr/share/doc/libghc-enumerator-doc/html/src/Data-Enumerator-List.html is in libghc-enumerator-doc 0.4.19-3build1.
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 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 | <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<!-- Generated by HsColour, http://code.haskell.org/~malcolm/hscolour/ -->
<title>lib/Data/Enumerator/List.hs</title>
<link type='text/css' rel='stylesheet' href='hscolour.css' />
</head>
<body>
<pre><a name="line-1"></a><span class='hs-comment'>-- |</span>
<a name="line-2"></a><span class='hs-comment'>-- Module: Data.Enumerator.List</span>
<a name="line-3"></a><span class='hs-comment'>-- Copyright: 2010-2011 John Millikin</span>
<a name="line-4"></a><span class='hs-comment'>-- License: MIT</span>
<a name="line-5"></a><span class='hs-comment'>--</span>
<a name="line-6"></a><span class='hs-comment'>-- Maintainer: jmillikin@gmail.com</span>
<a name="line-7"></a><span class='hs-comment'>-- Portability: portable</span>
<a name="line-8"></a><span class='hs-comment'>--</span>
<a name="line-9"></a><span class='hs-comment'>-- This module is intended to be imported qualified:</span>
<a name="line-10"></a><span class='hs-comment'>--</span>
<a name="line-11"></a><span class='hs-comment'>-- @</span>
<a name="line-12"></a><span class='hs-comment'>-- import qualified Data.Enumerator.List as EL</span>
<a name="line-13"></a><span class='hs-comment'>-- @</span>
<a name="line-14"></a><span class='hs-comment'>--</span>
<a name="line-15"></a><span class='hs-comment'>-- Since: 0.4.5</span>
<a name="line-16"></a><span class='hs-keyword'>module</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>Enumerator</span><span class='hs-varop'>.</span><span class='hs-conid'>List</span>
<a name="line-17"></a> <span class='hs-layout'>(</span>
<a name="line-18"></a>
<a name="line-19"></a> <span class='hs-comment'>-- * List analogues</span>
<a name="line-20"></a>
<a name="line-21"></a> <span class='hs-comment'>-- ** Folds</span>
<a name="line-22"></a> <span class='hs-varid'>fold</span>
<a name="line-23"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>foldM</span>
<a name="line-24"></a>
<a name="line-25"></a> <span class='hs-comment'>-- ** Maps</span>
<a name="line-26"></a> <span class='hs-layout'>,</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>Enumerator</span><span class='hs-varop'>.</span><span class='hs-conid'>List</span><span class='hs-varop'>.</span><span class='hs-varid'>map</span>
<a name="line-27"></a> <span class='hs-layout'>,</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>Enumerator</span><span class='hs-varop'>.</span><span class='hs-conid'>List</span><span class='hs-varop'>.</span><span class='hs-varid'>mapM</span>
<a name="line-28"></a> <span class='hs-layout'>,</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>Enumerator</span><span class='hs-varop'>.</span><span class='hs-conid'>List</span><span class='hs-varop'>.</span><span class='hs-varid'>mapM_</span>
<a name="line-29"></a> <span class='hs-layout'>,</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>Enumerator</span><span class='hs-varop'>.</span><span class='hs-conid'>List</span><span class='hs-varop'>.</span><span class='hs-varid'>concatMap</span>
<a name="line-30"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>concatMapM</span>
<a name="line-31"></a>
<a name="line-32"></a> <span class='hs-comment'>-- ** Accumulating maps</span>
<a name="line-33"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>mapAccum</span>
<a name="line-34"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>mapAccumM</span>
<a name="line-35"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>concatMapAccum</span>
<a name="line-36"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>concatMapAccumM</span>
<a name="line-37"></a>
<a name="line-38"></a> <span class='hs-comment'>-- ** Infinite streams</span>
<a name="line-39"></a> <span class='hs-layout'>,</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>Enumerator</span><span class='hs-varop'>.</span><span class='hs-conid'>List</span><span class='hs-varop'>.</span><span class='hs-varid'>iterate</span>
<a name="line-40"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>iterateM</span>
<a name="line-41"></a> <span class='hs-layout'>,</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>Enumerator</span><span class='hs-varop'>.</span><span class='hs-conid'>List</span><span class='hs-varop'>.</span><span class='hs-varid'>repeat</span>
<a name="line-42"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>repeatM</span>
<a name="line-43"></a>
<a name="line-44"></a> <span class='hs-comment'>-- ** Bounded streams</span>
<a name="line-45"></a> <span class='hs-layout'>,</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>Enumerator</span><span class='hs-varop'>.</span><span class='hs-conid'>List</span><span class='hs-varop'>.</span><span class='hs-varid'>replicate</span>
<a name="line-46"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>replicateM</span>
<a name="line-47"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>generateM</span>
<a name="line-48"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>unfold</span>
<a name="line-49"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>unfoldM</span>
<a name="line-50"></a>
<a name="line-51"></a> <span class='hs-comment'>-- ** Dropping input</span>
<a name="line-52"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>drop</span>
<a name="line-53"></a> <span class='hs-layout'>,</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>Enumerator</span><span class='hs-varop'>.</span><span class='hs-conid'>List</span><span class='hs-varop'>.</span><span class='hs-varid'>dropWhile</span>
<a name="line-54"></a> <span class='hs-layout'>,</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>Enumerator</span><span class='hs-varop'>.</span><span class='hs-conid'>List</span><span class='hs-varop'>.</span><span class='hs-varid'>filter</span>
<a name="line-55"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>filterM</span>
<a name="line-56"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>unique</span>
<a name="line-57"></a>
<a name="line-58"></a> <span class='hs-comment'>-- ** Consumers</span>
<a name="line-59"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>head</span>
<a name="line-60"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>head_</span>
<a name="line-61"></a> <span class='hs-layout'>,</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>Enumerator</span><span class='hs-varop'>.</span><span class='hs-conid'>List</span><span class='hs-varop'>.</span><span class='hs-varid'>take</span>
<a name="line-62"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>takeWhile</span>
<a name="line-63"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>consume</span>
<a name="line-64"></a>
<a name="line-65"></a> <span class='hs-comment'>-- ** Zipping</span>
<a name="line-66"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>zip</span>
<a name="line-67"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>zip3</span>
<a name="line-68"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>zip4</span>
<a name="line-69"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>zip5</span>
<a name="line-70"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>zip6</span>
<a name="line-71"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>zip7</span>
<a name="line-72"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>zipWith</span>
<a name="line-73"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>zipWith3</span>
<a name="line-74"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>zipWith4</span>
<a name="line-75"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>zipWith5</span>
<a name="line-76"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>zipWith6</span>
<a name="line-77"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>zipWith7</span>
<a name="line-78"></a>
<a name="line-79"></a> <span class='hs-comment'>-- ** Unsorted</span>
<a name="line-80"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>require</span>
<a name="line-81"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>isolate</span>
<a name="line-82"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>isolateWhile</span>
<a name="line-83"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>splitWhen</span>
<a name="line-84"></a>
<a name="line-85"></a> <span class='hs-layout'>)</span> <span class='hs-keyword'>where</span>
<a name="line-86"></a>
<a name="line-87"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Prelude</span> <span class='hs-varid'>hiding</span> <span class='hs-layout'>(</span><span class='hs-varid'>head</span><span class='hs-layout'>,</span> <span class='hs-varid'>drop</span><span class='hs-layout'>,</span> <span class='hs-varid'>sequence</span><span class='hs-layout'>,</span> <span class='hs-varid'>takeWhile</span><span class='hs-layout'>,</span> <span class='hs-varid'>zip</span><span class='hs-layout'>,</span> <span class='hs-varid'>zip3</span><span class='hs-layout'>,</span> <span class='hs-varid'>zipWith</span><span class='hs-layout'>,</span> <span class='hs-varid'>zipWith3</span><span class='hs-layout'>)</span>
<a name="line-88"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Control</span><span class='hs-varop'>.</span><span class='hs-conid'>Exception</span> <span class='hs-layout'>(</span><span class='hs-conid'>ErrorCall</span><span class='hs-layout'>(</span><span class='hs-keyglyph'>..</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span>
<a name="line-89"></a><span class='hs-keyword'>import</span> <span class='hs-keyword'>qualified</span> <span class='hs-conid'>Control</span><span class='hs-varop'>.</span><span class='hs-conid'>Monad</span> <span class='hs-keyword'>as</span> <span class='hs-conid'>CM</span>
<a name="line-90"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Control</span><span class='hs-varop'>.</span><span class='hs-conid'>Monad</span><span class='hs-varop'>.</span><span class='hs-conid'>Trans</span><span class='hs-varop'>.</span><span class='hs-conid'>Class</span> <span class='hs-layout'>(</span><span class='hs-varid'>lift</span><span class='hs-layout'>)</span>
<a name="line-91"></a><span class='hs-keyword'>import</span> <span class='hs-keyword'>qualified</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>List</span> <span class='hs-keyword'>as</span> <span class='hs-conid'>L</span>
<a name="line-92"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>Monoid</span> <span class='hs-layout'>(</span><span class='hs-varid'>mappend</span><span class='hs-layout'>)</span>
<a name="line-93"></a><span class='hs-keyword'>import</span> <span class='hs-keyword'>qualified</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>Set</span>
<a name="line-94"></a>
<a name="line-95"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>Enumerator</span> <span class='hs-layout'>(</span><span class='hs-varid'>sequence</span><span class='hs-layout'>,</span> <span class='hs-varid'>throwError</span><span class='hs-layout'>)</span>
<a name="line-96"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>Enumerator</span><span class='hs-varop'>.</span><span class='hs-conid'>Internal</span>
<a name="line-97"></a>
<a name="line-98"></a><a name="fold"></a><span class='hs-comment'>-- | Consume the entire input stream with a strict left fold, one element</span>
<a name="line-99"></a><span class='hs-comment'>-- at a time.</span>
<a name="line-100"></a><span class='hs-comment'>--</span>
<a name="line-101"></a><span class='hs-comment'>-- Since: 0.4.8</span>
<a name="line-102"></a><span class='hs-definition'>fold</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Monad</span> <span class='hs-varid'>m</span> <span class='hs-keyglyph'>=></span> <span class='hs-layout'>(</span><span class='hs-varid'>b</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>b</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>b</span>
<a name="line-103"></a> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Iteratee</span> <span class='hs-varid'>a</span> <span class='hs-varid'>m</span> <span class='hs-varid'>b</span>
<a name="line-104"></a><span class='hs-definition'>fold</span> <span class='hs-varid'>step</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>continue</span> <span class='hs-varop'>.</span> <span class='hs-varid'>loop</span> <span class='hs-keyword'>where</span>
<a name="line-105"></a> <span class='hs-varid'>f</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>L</span><span class='hs-varop'>.</span><span class='hs-varid'>foldl'</span> <span class='hs-varid'>step</span>
<a name="line-106"></a> <span class='hs-varid'>loop</span> <span class='hs-varid'>acc</span> <span class='hs-varid'>stream</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>case</span> <span class='hs-varid'>stream</span> <span class='hs-keyword'>of</span>
<a name="line-107"></a> <span class='hs-conid'>Chunks</span> <span class='hs-conid'>[]</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>continue</span> <span class='hs-layout'>(</span><span class='hs-varid'>loop</span> <span class='hs-varid'>acc</span><span class='hs-layout'>)</span>
<a name="line-108"></a> <span class='hs-conid'>Chunks</span> <span class='hs-varid'>xs</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>continue</span> <span class='hs-layout'>(</span><span class='hs-varid'>loop</span> <span class='hs-varop'>$!</span> <span class='hs-varid'>f</span> <span class='hs-varid'>acc</span> <span class='hs-varid'>xs</span><span class='hs-layout'>)</span>
<a name="line-109"></a> <span class='hs-conid'>EOF</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>yield</span> <span class='hs-varid'>acc</span> <span class='hs-conid'>EOF</span>
<a name="line-110"></a>
<a name="line-111"></a><a name="foldM"></a><span class='hs-comment'>-- | Consume the entire input stream with a strict monadic left fold, one</span>
<a name="line-112"></a><span class='hs-comment'>-- element at a time.</span>
<a name="line-113"></a><span class='hs-comment'>--</span>
<a name="line-114"></a><span class='hs-comment'>-- Since: 0.4.8</span>
<a name="line-115"></a><span class='hs-definition'>foldM</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Monad</span> <span class='hs-varid'>m</span> <span class='hs-keyglyph'>=></span> <span class='hs-layout'>(</span><span class='hs-varid'>b</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>m</span> <span class='hs-varid'>b</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>b</span>
<a name="line-116"></a> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Iteratee</span> <span class='hs-varid'>a</span> <span class='hs-varid'>m</span> <span class='hs-varid'>b</span>
<a name="line-117"></a><span class='hs-definition'>foldM</span> <span class='hs-varid'>step</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>continue</span> <span class='hs-varop'>.</span> <span class='hs-varid'>loop</span> <span class='hs-keyword'>where</span>
<a name="line-118"></a> <span class='hs-varid'>f</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>CM</span><span class='hs-varop'>.</span><span class='hs-varid'>foldM</span> <span class='hs-varid'>step</span>
<a name="line-119"></a>
<a name="line-120"></a> <span class='hs-varid'>loop</span> <span class='hs-varid'>acc</span> <span class='hs-varid'>stream</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>acc</span> <span class='hs-varop'>`seq`</span> <span class='hs-keyword'>case</span> <span class='hs-varid'>stream</span> <span class='hs-keyword'>of</span>
<a name="line-121"></a> <span class='hs-conid'>Chunks</span> <span class='hs-conid'>[]</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>continue</span> <span class='hs-layout'>(</span><span class='hs-varid'>loop</span> <span class='hs-varid'>acc</span><span class='hs-layout'>)</span>
<a name="line-122"></a> <span class='hs-conid'>Chunks</span> <span class='hs-varid'>xs</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>lift</span> <span class='hs-layout'>(</span><span class='hs-varid'>f</span> <span class='hs-varid'>acc</span> <span class='hs-varid'>xs</span><span class='hs-layout'>)</span> <span class='hs-varop'>>>=</span> <span class='hs-varid'>continue</span> <span class='hs-varop'>.</span> <span class='hs-varid'>loop</span>
<a name="line-123"></a> <span class='hs-conid'>EOF</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>yield</span> <span class='hs-varid'>acc</span> <span class='hs-conid'>EOF</span>
<a name="line-124"></a>
<a name="line-125"></a><a name="unfold"></a><span class='hs-comment'>-- | Enumerates a stream of elements by repeatedly applying a function to</span>
<a name="line-126"></a><span class='hs-comment'>-- some state.</span>
<a name="line-127"></a><span class='hs-comment'>--</span>
<a name="line-128"></a><span class='hs-comment'>-- Similar to 'Data.Enumerator.List.iterate'.</span>
<a name="line-129"></a><span class='hs-comment'>--</span>
<a name="line-130"></a><span class='hs-comment'>-- Since: 0.4.8</span>
<a name="line-131"></a><span class='hs-definition'>unfold</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Monad</span> <span class='hs-varid'>m</span> <span class='hs-keyglyph'>=></span> <span class='hs-layout'>(</span><span class='hs-varid'>s</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Maybe</span> <span class='hs-layout'>(</span><span class='hs-varid'>a</span><span class='hs-layout'>,</span> <span class='hs-varid'>s</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>s</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Enumerator</span> <span class='hs-varid'>a</span> <span class='hs-varid'>m</span> <span class='hs-varid'>b</span>
<a name="line-132"></a><span class='hs-definition'>unfold</span> <span class='hs-varid'>f</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>checkContinue1</span> <span class='hs-varop'>$</span> <span class='hs-keyglyph'>\</span><span class='hs-varid'>loop</span> <span class='hs-varid'>s</span> <span class='hs-varid'>k</span> <span class='hs-keyglyph'>-></span> <span class='hs-keyword'>case</span> <span class='hs-varid'>f</span> <span class='hs-varid'>s</span> <span class='hs-keyword'>of</span>
<a name="line-133"></a> <span class='hs-conid'>Nothing</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>continue</span> <span class='hs-varid'>k</span>
<a name="line-134"></a> <span class='hs-conid'>Just</span> <span class='hs-layout'>(</span><span class='hs-varid'>a</span><span class='hs-layout'>,</span> <span class='hs-varid'>s'</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>k</span> <span class='hs-layout'>(</span><span class='hs-conid'>Chunks</span> <span class='hs-keyglyph'>[</span><span class='hs-varid'>a</span><span class='hs-keyglyph'>]</span><span class='hs-layout'>)</span> <span class='hs-varop'>>>==</span> <span class='hs-varid'>loop</span> <span class='hs-varid'>s'</span>
<a name="line-135"></a>
<a name="line-136"></a><a name="unfoldM"></a><span class='hs-comment'>-- | Enumerates a stream of elements by repeatedly applying a computation to</span>
<a name="line-137"></a><span class='hs-comment'>-- some state.</span>
<a name="line-138"></a><span class='hs-comment'>--</span>
<a name="line-139"></a><span class='hs-comment'>-- Similar to 'iterateM'.</span>
<a name="line-140"></a><span class='hs-comment'>--</span>
<a name="line-141"></a><span class='hs-comment'>-- Since: 0.4.8</span>
<a name="line-142"></a><span class='hs-definition'>unfoldM</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Monad</span> <span class='hs-varid'>m</span> <span class='hs-keyglyph'>=></span> <span class='hs-layout'>(</span><span class='hs-varid'>s</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>m</span> <span class='hs-layout'>(</span><span class='hs-conid'>Maybe</span> <span class='hs-layout'>(</span><span class='hs-varid'>a</span><span class='hs-layout'>,</span> <span class='hs-varid'>s</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>s</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Enumerator</span> <span class='hs-varid'>a</span> <span class='hs-varid'>m</span> <span class='hs-varid'>b</span>
<a name="line-143"></a><span class='hs-definition'>unfoldM</span> <span class='hs-varid'>f</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>checkContinue1</span> <span class='hs-varop'>$</span> <span class='hs-keyglyph'>\</span><span class='hs-varid'>loop</span> <span class='hs-varid'>s</span> <span class='hs-varid'>k</span> <span class='hs-keyglyph'>-></span> <span class='hs-keyword'>do</span>
<a name="line-144"></a> <span class='hs-varid'>fs</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>lift</span> <span class='hs-layout'>(</span><span class='hs-varid'>f</span> <span class='hs-varid'>s</span><span class='hs-layout'>)</span>
<a name="line-145"></a> <span class='hs-keyword'>case</span> <span class='hs-varid'>fs</span> <span class='hs-keyword'>of</span>
<a name="line-146"></a> <span class='hs-conid'>Nothing</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>continue</span> <span class='hs-varid'>k</span>
<a name="line-147"></a> <span class='hs-conid'>Just</span> <span class='hs-layout'>(</span><span class='hs-varid'>a</span><span class='hs-layout'>,</span> <span class='hs-varid'>s'</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>k</span> <span class='hs-layout'>(</span><span class='hs-conid'>Chunks</span> <span class='hs-keyglyph'>[</span><span class='hs-varid'>a</span><span class='hs-keyglyph'>]</span><span class='hs-layout'>)</span> <span class='hs-varop'>>>==</span> <span class='hs-varid'>loop</span> <span class='hs-varid'>s'</span>
<a name="line-148"></a>
<a name="line-149"></a><a name="concatMapM"></a><span class='hs-comment'>-- | @'concatMapM' f@ applies /f/ to each input element and feeds the</span>
<a name="line-150"></a><span class='hs-comment'>-- resulting outputs to the inner iteratee.</span>
<a name="line-151"></a><span class='hs-comment'>--</span>
<a name="line-152"></a><span class='hs-comment'>-- Since: 0.4.8</span>
<a name="line-153"></a><span class='hs-definition'>concatMapM</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Monad</span> <span class='hs-varid'>m</span> <span class='hs-keyglyph'>=></span> <span class='hs-layout'>(</span><span class='hs-varid'>ao</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>m</span> <span class='hs-keyglyph'>[</span><span class='hs-varid'>ai</span><span class='hs-keyglyph'>]</span><span class='hs-layout'>)</span>
<a name="line-154"></a> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Enumeratee</span> <span class='hs-varid'>ao</span> <span class='hs-varid'>ai</span> <span class='hs-varid'>m</span> <span class='hs-varid'>b</span>
<a name="line-155"></a><span class='hs-definition'>concatMapM</span> <span class='hs-varid'>f</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>checkDone</span> <span class='hs-layout'>(</span><span class='hs-varid'>continue</span> <span class='hs-varop'>.</span> <span class='hs-varid'>step</span><span class='hs-layout'>)</span> <span class='hs-keyword'>where</span>
<a name="line-156"></a> <span class='hs-varid'>step</span> <span class='hs-varid'>k</span> <span class='hs-conid'>EOF</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>yield</span> <span class='hs-layout'>(</span><span class='hs-conid'>Continue</span> <span class='hs-varid'>k</span><span class='hs-layout'>)</span> <span class='hs-conid'>EOF</span>
<a name="line-157"></a> <span class='hs-varid'>step</span> <span class='hs-varid'>k</span> <span class='hs-layout'>(</span><span class='hs-conid'>Chunks</span> <span class='hs-varid'>xs</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>loop</span> <span class='hs-varid'>k</span> <span class='hs-varid'>xs</span>
<a name="line-158"></a>
<a name="line-159"></a> <span class='hs-varid'>loop</span> <span class='hs-varid'>k</span> <span class='hs-conid'>[]</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>continue</span> <span class='hs-layout'>(</span><span class='hs-varid'>step</span> <span class='hs-varid'>k</span><span class='hs-layout'>)</span>
<a name="line-160"></a> <span class='hs-varid'>loop</span> <span class='hs-varid'>k</span> <span class='hs-layout'>(</span><span class='hs-varid'>x</span><span class='hs-conop'>:</span><span class='hs-varid'>xs</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>do</span>
<a name="line-161"></a> <span class='hs-varid'>fx</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>lift</span> <span class='hs-layout'>(</span><span class='hs-varid'>f</span> <span class='hs-varid'>x</span><span class='hs-layout'>)</span>
<a name="line-162"></a> <span class='hs-varid'>k</span> <span class='hs-layout'>(</span><span class='hs-conid'>Chunks</span> <span class='hs-varid'>fx</span><span class='hs-layout'>)</span> <span class='hs-varop'>>>==</span>
<a name="line-163"></a> <span class='hs-varid'>checkDoneEx</span> <span class='hs-layout'>(</span><span class='hs-conid'>Chunks</span> <span class='hs-varid'>xs</span><span class='hs-layout'>)</span> <span class='hs-layout'>(</span><span class='hs-varop'>`loop`</span> <span class='hs-varid'>xs</span><span class='hs-layout'>)</span>
<a name="line-164"></a>
<a name="line-165"></a><a name="concatMap"></a><span class='hs-comment'>-- | @'Data.Enumerator.List.concatMap' f@ applies /f/ to each input element</span>
<a name="line-166"></a><span class='hs-comment'>-- and feeds the resulting outputs to the inner iteratee.</span>
<a name="line-167"></a><span class='hs-comment'>--</span>
<a name="line-168"></a><span class='hs-comment'>-- Since: 0.4.8</span>
<a name="line-169"></a><span class='hs-definition'>concatMap</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Monad</span> <span class='hs-varid'>m</span> <span class='hs-keyglyph'>=></span> <span class='hs-layout'>(</span><span class='hs-varid'>ao</span> <span class='hs-keyglyph'>-></span> <span class='hs-keyglyph'>[</span><span class='hs-varid'>ai</span><span class='hs-keyglyph'>]</span><span class='hs-layout'>)</span>
<a name="line-170"></a> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Enumeratee</span> <span class='hs-varid'>ao</span> <span class='hs-varid'>ai</span> <span class='hs-varid'>m</span> <span class='hs-varid'>b</span>
<a name="line-171"></a><span class='hs-definition'>concatMap</span> <span class='hs-varid'>f</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>concatMapM</span> <span class='hs-layout'>(</span><span class='hs-varid'>return</span> <span class='hs-varop'>.</span> <span class='hs-varid'>f</span><span class='hs-layout'>)</span>
<a name="line-172"></a>
<a name="line-173"></a><a name="map"></a><span class='hs-comment'>-- | @'Data.Enumerator.List.map' f@ applies /f/ to each input element and</span>
<a name="line-174"></a><span class='hs-comment'>-- feeds the resulting outputs to the inner iteratee.</span>
<a name="line-175"></a><span class='hs-comment'>--</span>
<a name="line-176"></a><span class='hs-comment'>-- Since: 0.4.8</span>
<a name="line-177"></a><span class='hs-definition'>map</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Monad</span> <span class='hs-varid'>m</span> <span class='hs-keyglyph'>=></span> <span class='hs-layout'>(</span><span class='hs-varid'>ao</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>ai</span><span class='hs-layout'>)</span>
<a name="line-178"></a> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Enumeratee</span> <span class='hs-varid'>ao</span> <span class='hs-varid'>ai</span> <span class='hs-varid'>m</span> <span class='hs-varid'>b</span>
<a name="line-179"></a><span class='hs-definition'>map</span> <span class='hs-varid'>f</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>Enumerator</span><span class='hs-varop'>.</span><span class='hs-conid'>List</span><span class='hs-varop'>.</span><span class='hs-varid'>concatMap</span> <span class='hs-layout'>(</span><span class='hs-keyglyph'>\</span><span class='hs-varid'>x</span> <span class='hs-keyglyph'>-></span> <span class='hs-keyglyph'>[</span><span class='hs-varid'>f</span> <span class='hs-varid'>x</span><span class='hs-keyglyph'>]</span><span class='hs-layout'>)</span>
<a name="line-180"></a>
<a name="line-181"></a><a name="mapM"></a><span class='hs-comment'>-- | @'Data.Enumerator.List.mapM' f@ applies /f/ to each input element and</span>
<a name="line-182"></a><span class='hs-comment'>-- feeds the resulting outputs to the inner iteratee.</span>
<a name="line-183"></a><span class='hs-comment'>--</span>
<a name="line-184"></a><span class='hs-comment'>-- Since: 0.4.8</span>
<a name="line-185"></a><span class='hs-definition'>mapM</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Monad</span> <span class='hs-varid'>m</span> <span class='hs-keyglyph'>=></span> <span class='hs-layout'>(</span><span class='hs-varid'>ao</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>m</span> <span class='hs-varid'>ai</span><span class='hs-layout'>)</span>
<a name="line-186"></a> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Enumeratee</span> <span class='hs-varid'>ao</span> <span class='hs-varid'>ai</span> <span class='hs-varid'>m</span> <span class='hs-varid'>b</span>
<a name="line-187"></a><span class='hs-definition'>mapM</span> <span class='hs-varid'>f</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>concatMapM</span> <span class='hs-layout'>(</span><span class='hs-keyglyph'>\</span><span class='hs-varid'>x</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Prelude</span><span class='hs-varop'>.</span><span class='hs-varid'>mapM</span> <span class='hs-varid'>f</span> <span class='hs-keyglyph'>[</span><span class='hs-varid'>x</span><span class='hs-keyglyph'>]</span><span class='hs-layout'>)</span>
<a name="line-188"></a>
<a name="line-189"></a><a name="mapM_"></a><span class='hs-comment'>-- | @'Data.Enumerator.List.mapM_' f@ applies /f/ to each input element, and</span>
<a name="line-190"></a><span class='hs-comment'>-- discards the results.</span>
<a name="line-191"></a><span class='hs-comment'>--</span>
<a name="line-192"></a><span class='hs-comment'>-- Since: 0.4.11</span>
<a name="line-193"></a><span class='hs-definition'>mapM_</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Monad</span> <span class='hs-varid'>m</span> <span class='hs-keyglyph'>=></span> <span class='hs-layout'>(</span><span class='hs-varid'>a</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>m</span> <span class='hs-varid'>b</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Iteratee</span> <span class='hs-varid'>a</span> <span class='hs-varid'>m</span> <span class='hs-conid'>()</span>
<a name="line-194"></a><span class='hs-definition'>mapM_</span> <span class='hs-varid'>f</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>foldM</span> <span class='hs-layout'>(</span><span class='hs-keyglyph'>\</span><span class='hs-keyword'>_</span> <span class='hs-varid'>x</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>f</span> <span class='hs-varid'>x</span> <span class='hs-varop'>>></span> <span class='hs-varid'>return</span> <span class='hs-conid'>()</span><span class='hs-layout'>)</span> <span class='hs-conid'>()</span>
<a name="line-195"></a>
<a name="line-196"></a><a name="concatMapAccum"></a><span class='hs-comment'>-- | Similar to 'Data.Enumerator.List.concatMap', but with a stateful step</span>
<a name="line-197"></a><span class='hs-comment'>-- function.</span>
<a name="line-198"></a><span class='hs-comment'>--</span>
<a name="line-199"></a><span class='hs-comment'>-- Since: 0.4.11</span>
<a name="line-200"></a><span class='hs-definition'>concatMapAccum</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Monad</span> <span class='hs-varid'>m</span> <span class='hs-keyglyph'>=></span> <span class='hs-layout'>(</span><span class='hs-varid'>s</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>ao</span> <span class='hs-keyglyph'>-></span> <span class='hs-layout'>(</span><span class='hs-varid'>s</span><span class='hs-layout'>,</span> <span class='hs-keyglyph'>[</span><span class='hs-varid'>ai</span><span class='hs-keyglyph'>]</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>s</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Enumeratee</span> <span class='hs-varid'>ao</span> <span class='hs-varid'>ai</span> <span class='hs-varid'>m</span> <span class='hs-varid'>b</span>
<a name="line-201"></a><span class='hs-definition'>concatMapAccum</span> <span class='hs-varid'>f</span> <span class='hs-varid'>s0</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>checkDone</span> <span class='hs-layout'>(</span><span class='hs-varid'>continue</span> <span class='hs-varop'>.</span> <span class='hs-varid'>step</span> <span class='hs-varid'>s0</span><span class='hs-layout'>)</span> <span class='hs-keyword'>where</span>
<a name="line-202"></a> <span class='hs-varid'>step</span> <span class='hs-keyword'>_</span> <span class='hs-varid'>k</span> <span class='hs-conid'>EOF</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>yield</span> <span class='hs-layout'>(</span><span class='hs-conid'>Continue</span> <span class='hs-varid'>k</span><span class='hs-layout'>)</span> <span class='hs-conid'>EOF</span>
<a name="line-203"></a> <span class='hs-varid'>step</span> <span class='hs-varid'>s</span> <span class='hs-varid'>k</span> <span class='hs-layout'>(</span><span class='hs-conid'>Chunks</span> <span class='hs-varid'>xs</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>loop</span> <span class='hs-varid'>s</span> <span class='hs-varid'>k</span> <span class='hs-varid'>xs</span>
<a name="line-204"></a>
<a name="line-205"></a> <span class='hs-varid'>loop</span> <span class='hs-varid'>s</span> <span class='hs-varid'>k</span> <span class='hs-conid'>[]</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>continue</span> <span class='hs-layout'>(</span><span class='hs-varid'>step</span> <span class='hs-varid'>s</span> <span class='hs-varid'>k</span><span class='hs-layout'>)</span>
<a name="line-206"></a> <span class='hs-varid'>loop</span> <span class='hs-varid'>s</span> <span class='hs-varid'>k</span> <span class='hs-layout'>(</span><span class='hs-varid'>x</span><span class='hs-conop'>:</span><span class='hs-varid'>xs</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>case</span> <span class='hs-varid'>f</span> <span class='hs-varid'>s</span> <span class='hs-varid'>x</span> <span class='hs-keyword'>of</span>
<a name="line-207"></a> <span class='hs-layout'>(</span><span class='hs-varid'>s'</span><span class='hs-layout'>,</span> <span class='hs-varid'>ai</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>k</span> <span class='hs-layout'>(</span><span class='hs-conid'>Chunks</span> <span class='hs-varid'>ai</span><span class='hs-layout'>)</span> <span class='hs-varop'>>>==</span>
<a name="line-208"></a> <span class='hs-varid'>checkDoneEx</span> <span class='hs-layout'>(</span><span class='hs-conid'>Chunks</span> <span class='hs-varid'>xs</span><span class='hs-layout'>)</span> <span class='hs-layout'>(</span><span class='hs-keyglyph'>\</span><span class='hs-varid'>k'</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>loop</span> <span class='hs-varid'>s'</span> <span class='hs-varid'>k'</span> <span class='hs-varid'>xs</span><span class='hs-layout'>)</span>
<a name="line-209"></a>
<a name="line-210"></a><a name="concatMapAccumM"></a><span class='hs-comment'>-- | Similar to 'concatMapM', but with a stateful step function.</span>
<a name="line-211"></a><span class='hs-comment'>--</span>
<a name="line-212"></a><span class='hs-comment'>-- Since: 0.4.11</span>
<a name="line-213"></a><span class='hs-definition'>concatMapAccumM</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Monad</span> <span class='hs-varid'>m</span> <span class='hs-keyglyph'>=></span> <span class='hs-layout'>(</span><span class='hs-varid'>s</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>ao</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>m</span> <span class='hs-layout'>(</span><span class='hs-varid'>s</span><span class='hs-layout'>,</span> <span class='hs-keyglyph'>[</span><span class='hs-varid'>ai</span><span class='hs-keyglyph'>]</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>s</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Enumeratee</span> <span class='hs-varid'>ao</span> <span class='hs-varid'>ai</span> <span class='hs-varid'>m</span> <span class='hs-varid'>b</span>
<a name="line-214"></a><span class='hs-definition'>concatMapAccumM</span> <span class='hs-varid'>f</span> <span class='hs-varid'>s0</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>checkDone</span> <span class='hs-layout'>(</span><span class='hs-varid'>continue</span> <span class='hs-varop'>.</span> <span class='hs-varid'>step</span> <span class='hs-varid'>s0</span><span class='hs-layout'>)</span> <span class='hs-keyword'>where</span>
<a name="line-215"></a> <span class='hs-varid'>step</span> <span class='hs-keyword'>_</span> <span class='hs-varid'>k</span> <span class='hs-conid'>EOF</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>yield</span> <span class='hs-layout'>(</span><span class='hs-conid'>Continue</span> <span class='hs-varid'>k</span><span class='hs-layout'>)</span> <span class='hs-conid'>EOF</span>
<a name="line-216"></a> <span class='hs-varid'>step</span> <span class='hs-varid'>s</span> <span class='hs-varid'>k</span> <span class='hs-layout'>(</span><span class='hs-conid'>Chunks</span> <span class='hs-varid'>xs</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>loop</span> <span class='hs-varid'>s</span> <span class='hs-varid'>k</span> <span class='hs-varid'>xs</span>
<a name="line-217"></a>
<a name="line-218"></a> <span class='hs-varid'>loop</span> <span class='hs-varid'>s</span> <span class='hs-varid'>k</span> <span class='hs-conid'>[]</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>continue</span> <span class='hs-layout'>(</span><span class='hs-varid'>step</span> <span class='hs-varid'>s</span> <span class='hs-varid'>k</span><span class='hs-layout'>)</span>
<a name="line-219"></a> <span class='hs-varid'>loop</span> <span class='hs-varid'>s</span> <span class='hs-varid'>k</span> <span class='hs-layout'>(</span><span class='hs-varid'>x</span><span class='hs-conop'>:</span><span class='hs-varid'>xs</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>do</span>
<a name="line-220"></a> <span class='hs-layout'>(</span><span class='hs-varid'>s'</span><span class='hs-layout'>,</span> <span class='hs-varid'>ai</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>lift</span> <span class='hs-layout'>(</span><span class='hs-varid'>f</span> <span class='hs-varid'>s</span> <span class='hs-varid'>x</span><span class='hs-layout'>)</span>
<a name="line-221"></a> <span class='hs-varid'>k</span> <span class='hs-layout'>(</span><span class='hs-conid'>Chunks</span> <span class='hs-varid'>ai</span><span class='hs-layout'>)</span> <span class='hs-varop'>>>==</span>
<a name="line-222"></a> <span class='hs-varid'>checkDoneEx</span> <span class='hs-layout'>(</span><span class='hs-conid'>Chunks</span> <span class='hs-varid'>xs</span><span class='hs-layout'>)</span> <span class='hs-layout'>(</span><span class='hs-keyglyph'>\</span><span class='hs-varid'>k'</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>loop</span> <span class='hs-varid'>s'</span> <span class='hs-varid'>k'</span> <span class='hs-varid'>xs</span><span class='hs-layout'>)</span>
<a name="line-223"></a>
<a name="line-224"></a><a name="mapAccum"></a><span class='hs-comment'>-- | Similar to 'Data.Enumerator.List.map', but with a stateful step function.</span>
<a name="line-225"></a><span class='hs-comment'>--</span>
<a name="line-226"></a><span class='hs-comment'>-- Since: 0.4.9</span>
<a name="line-227"></a><span class='hs-definition'>mapAccum</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Monad</span> <span class='hs-varid'>m</span> <span class='hs-keyglyph'>=></span> <span class='hs-layout'>(</span><span class='hs-varid'>s</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>ao</span> <span class='hs-keyglyph'>-></span> <span class='hs-layout'>(</span><span class='hs-varid'>s</span><span class='hs-layout'>,</span> <span class='hs-varid'>ai</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>s</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Enumeratee</span> <span class='hs-varid'>ao</span> <span class='hs-varid'>ai</span> <span class='hs-varid'>m</span> <span class='hs-varid'>b</span>
<a name="line-228"></a><span class='hs-definition'>mapAccum</span> <span class='hs-varid'>f</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>concatMapAccum</span> <span class='hs-layout'>(</span><span class='hs-keyglyph'>\</span><span class='hs-varid'>s</span> <span class='hs-varid'>ao</span> <span class='hs-keyglyph'>-></span> <span class='hs-keyword'>case</span> <span class='hs-varid'>f</span> <span class='hs-varid'>s</span> <span class='hs-varid'>ao</span> <span class='hs-keyword'>of</span> <span class='hs-layout'>(</span><span class='hs-varid'>s'</span><span class='hs-layout'>,</span> <span class='hs-varid'>ai</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-></span> <span class='hs-layout'>(</span><span class='hs-varid'>s'</span><span class='hs-layout'>,</span> <span class='hs-keyglyph'>[</span><span class='hs-varid'>ai</span><span class='hs-keyglyph'>]</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span>
<a name="line-229"></a>
<a name="line-230"></a><a name="mapAccumM"></a><span class='hs-comment'>-- | Similar to 'Data.Enumerator.List.mapM', but with a stateful step function.</span>
<a name="line-231"></a><span class='hs-comment'>--</span>
<a name="line-232"></a><span class='hs-comment'>-- Since: 0.4.9</span>
<a name="line-233"></a><span class='hs-definition'>mapAccumM</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Monad</span> <span class='hs-varid'>m</span> <span class='hs-keyglyph'>=></span> <span class='hs-layout'>(</span><span class='hs-varid'>s</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>ao</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>m</span> <span class='hs-layout'>(</span><span class='hs-varid'>s</span><span class='hs-layout'>,</span> <span class='hs-varid'>ai</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>s</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Enumeratee</span> <span class='hs-varid'>ao</span> <span class='hs-varid'>ai</span> <span class='hs-varid'>m</span> <span class='hs-varid'>b</span>
<a name="line-234"></a><span class='hs-definition'>mapAccumM</span> <span class='hs-varid'>f</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>concatMapAccumM</span> <span class='hs-layout'>(</span><span class='hs-keyglyph'>\</span><span class='hs-varid'>s</span> <span class='hs-varid'>ao</span> <span class='hs-keyglyph'>-></span> <span class='hs-keyword'>do</span>
<a name="line-235"></a> <span class='hs-layout'>(</span><span class='hs-varid'>s'</span><span class='hs-layout'>,</span> <span class='hs-varid'>ai</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>f</span> <span class='hs-varid'>s</span> <span class='hs-varid'>ao</span>
<a name="line-236"></a> <span class='hs-varid'>return</span> <span class='hs-layout'>(</span><span class='hs-varid'>s'</span><span class='hs-layout'>,</span> <span class='hs-keyglyph'>[</span><span class='hs-varid'>ai</span><span class='hs-keyglyph'>]</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span>
<a name="line-237"></a>
<a name="line-238"></a><a name="iterate"></a><span class='hs-comment'>-- | @'Data.Enumerator.List.iterate' f x@ enumerates an infinite stream of</span>
<a name="line-239"></a><span class='hs-comment'>-- repeated applications of /f/ to /x/.</span>
<a name="line-240"></a><span class='hs-comment'>--</span>
<a name="line-241"></a><span class='hs-comment'>-- Analogous to 'Prelude.iterate'.</span>
<a name="line-242"></a><span class='hs-comment'>--</span>
<a name="line-243"></a><span class='hs-comment'>-- Since: 0.4.8</span>
<a name="line-244"></a><span class='hs-definition'>iterate</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Monad</span> <span class='hs-varid'>m</span> <span class='hs-keyglyph'>=></span> <span class='hs-layout'>(</span><span class='hs-varid'>a</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>a</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Enumerator</span> <span class='hs-varid'>a</span> <span class='hs-varid'>m</span> <span class='hs-varid'>b</span>
<a name="line-245"></a><span class='hs-definition'>iterate</span> <span class='hs-varid'>f</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>checkContinue1</span> <span class='hs-varop'>$</span> <span class='hs-keyglyph'>\</span><span class='hs-varid'>loop</span> <span class='hs-varid'>s</span> <span class='hs-varid'>k</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>k</span> <span class='hs-layout'>(</span><span class='hs-conid'>Chunks</span> <span class='hs-keyglyph'>[</span><span class='hs-varid'>s</span><span class='hs-keyglyph'>]</span><span class='hs-layout'>)</span> <span class='hs-varop'>>>==</span> <span class='hs-varid'>loop</span> <span class='hs-layout'>(</span><span class='hs-varid'>f</span> <span class='hs-varid'>s</span><span class='hs-layout'>)</span>
<a name="line-246"></a>
<a name="line-247"></a><a name="iterateM"></a><span class='hs-comment'>-- | Similar to 'Data.Enumerator.List.iterate', except the iteration</span>
<a name="line-248"></a><span class='hs-comment'>-- function is monadic.</span>
<a name="line-249"></a><span class='hs-comment'>--</span>
<a name="line-250"></a><span class='hs-comment'>-- Since: 0.4.8</span>
<a name="line-251"></a><span class='hs-definition'>iterateM</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Monad</span> <span class='hs-varid'>m</span> <span class='hs-keyglyph'>=></span> <span class='hs-layout'>(</span><span class='hs-varid'>a</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>m</span> <span class='hs-varid'>a</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>a</span>
<a name="line-252"></a> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Enumerator</span> <span class='hs-varid'>a</span> <span class='hs-varid'>m</span> <span class='hs-varid'>b</span>
<a name="line-253"></a><span class='hs-definition'>iterateM</span> <span class='hs-varid'>f</span> <span class='hs-varid'>base</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>worker</span> <span class='hs-layout'>(</span><span class='hs-varid'>return</span> <span class='hs-varid'>base</span><span class='hs-layout'>)</span> <span class='hs-keyword'>where</span>
<a name="line-254"></a> <span class='hs-varid'>worker</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>checkContinue1</span> <span class='hs-varop'>$</span> <span class='hs-keyglyph'>\</span><span class='hs-varid'>loop</span> <span class='hs-varid'>m_a</span> <span class='hs-varid'>k</span> <span class='hs-keyglyph'>-></span> <span class='hs-keyword'>do</span>
<a name="line-255"></a> <span class='hs-varid'>a</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>lift</span> <span class='hs-varid'>m_a</span>
<a name="line-256"></a> <span class='hs-varid'>k</span> <span class='hs-layout'>(</span><span class='hs-conid'>Chunks</span> <span class='hs-keyglyph'>[</span><span class='hs-varid'>a</span><span class='hs-keyglyph'>]</span><span class='hs-layout'>)</span> <span class='hs-varop'>>>==</span> <span class='hs-varid'>loop</span> <span class='hs-layout'>(</span><span class='hs-varid'>f</span> <span class='hs-varid'>a</span><span class='hs-layout'>)</span>
<a name="line-257"></a>
<a name="line-258"></a><a name="repeat"></a><span class='hs-comment'>-- | Enumerates an infinite stream of a single element.</span>
<a name="line-259"></a><span class='hs-comment'>--</span>
<a name="line-260"></a><span class='hs-comment'>-- Analogous to 'Prelude.repeat'.</span>
<a name="line-261"></a><span class='hs-comment'>--</span>
<a name="line-262"></a><span class='hs-comment'>-- Since: 0.4.8</span>
<a name="line-263"></a><span class='hs-definition'>repeat</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Monad</span> <span class='hs-varid'>m</span> <span class='hs-keyglyph'>=></span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Enumerator</span> <span class='hs-varid'>a</span> <span class='hs-varid'>m</span> <span class='hs-varid'>b</span>
<a name="line-264"></a><span class='hs-definition'>repeat</span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>checkContinue0</span> <span class='hs-varop'>$</span> <span class='hs-keyglyph'>\</span><span class='hs-varid'>loop</span> <span class='hs-varid'>k</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>k</span> <span class='hs-layout'>(</span><span class='hs-conid'>Chunks</span> <span class='hs-keyglyph'>[</span><span class='hs-varid'>a</span><span class='hs-keyglyph'>]</span><span class='hs-layout'>)</span> <span class='hs-varop'>>>==</span> <span class='hs-varid'>loop</span>
<a name="line-265"></a>
<a name="line-266"></a><a name="repeatM"></a><span class='hs-comment'>-- | Enumerates an infinite stream of element. Each element is computed by</span>
<a name="line-267"></a><span class='hs-comment'>-- the underlying monad.</span>
<a name="line-268"></a><span class='hs-comment'>--</span>
<a name="line-269"></a><span class='hs-comment'>-- Since: 0.4.8</span>
<a name="line-270"></a><span class='hs-definition'>repeatM</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Monad</span> <span class='hs-varid'>m</span> <span class='hs-keyglyph'>=></span> <span class='hs-varid'>m</span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Enumerator</span> <span class='hs-varid'>a</span> <span class='hs-varid'>m</span> <span class='hs-varid'>b</span>
<a name="line-271"></a><span class='hs-definition'>repeatM</span> <span class='hs-varid'>m_a</span> <span class='hs-varid'>step</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>do</span>
<a name="line-272"></a> <span class='hs-varid'>a</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>lift</span> <span class='hs-varid'>m_a</span>
<a name="line-273"></a> <span class='hs-varid'>iterateM</span> <span class='hs-layout'>(</span><span class='hs-varid'>const</span> <span class='hs-varid'>m_a</span><span class='hs-layout'>)</span> <span class='hs-varid'>a</span> <span class='hs-varid'>step</span>
<a name="line-274"></a>
<a name="line-275"></a><a name="replicateM"></a><span class='hs-comment'>-- | @'replicateM' n m_x@ enumerates a stream of /n/ elements, with each</span>
<a name="line-276"></a><span class='hs-comment'>-- element computed by /m_x/.</span>
<a name="line-277"></a><span class='hs-comment'>--</span>
<a name="line-278"></a><span class='hs-comment'>-- Since: 0.4.8</span>
<a name="line-279"></a><span class='hs-definition'>replicateM</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Monad</span> <span class='hs-varid'>m</span> <span class='hs-keyglyph'>=></span> <span class='hs-conid'>Integer</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>m</span> <span class='hs-varid'>a</span>
<a name="line-280"></a> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Enumerator</span> <span class='hs-varid'>a</span> <span class='hs-varid'>m</span> <span class='hs-varid'>b</span>
<a name="line-281"></a><span class='hs-definition'>replicateM</span> <span class='hs-varid'>maxCount</span> <span class='hs-varid'>getNext</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>loop</span> <span class='hs-varid'>maxCount</span> <span class='hs-keyword'>where</span>
<a name="line-282"></a> <span class='hs-varid'>loop</span> <span class='hs-num'>0</span> <span class='hs-varid'>step</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>returnI</span> <span class='hs-varid'>step</span>
<a name="line-283"></a> <span class='hs-varid'>loop</span> <span class='hs-varid'>n</span> <span class='hs-layout'>(</span><span class='hs-conid'>Continue</span> <span class='hs-varid'>k</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>do</span>
<a name="line-284"></a> <span class='hs-varid'>next</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>lift</span> <span class='hs-varid'>getNext</span>
<a name="line-285"></a> <span class='hs-varid'>k</span> <span class='hs-layout'>(</span><span class='hs-conid'>Chunks</span> <span class='hs-keyglyph'>[</span><span class='hs-varid'>next</span><span class='hs-keyglyph'>]</span><span class='hs-layout'>)</span> <span class='hs-varop'>>>==</span> <span class='hs-varid'>loop</span> <span class='hs-layout'>(</span><span class='hs-varid'>n</span> <span class='hs-comment'>-</span> <span class='hs-num'>1</span><span class='hs-layout'>)</span>
<a name="line-286"></a> <span class='hs-varid'>loop</span> <span class='hs-keyword'>_</span> <span class='hs-varid'>step</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>returnI</span> <span class='hs-varid'>step</span>
<a name="line-287"></a>
<a name="line-288"></a><a name="replicate"></a><span class='hs-comment'>-- | @'Data.Enumerator.List.replicate' n x@ enumerates a stream containing</span>
<a name="line-289"></a><span class='hs-comment'>-- /n/ copies of /x/.</span>
<a name="line-290"></a><span class='hs-comment'>--</span>
<a name="line-291"></a><span class='hs-comment'>-- Analogous to 'Prelude.replicate'.</span>
<a name="line-292"></a><span class='hs-comment'>--</span>
<a name="line-293"></a><span class='hs-comment'>-- Since: 0.4.8</span>
<a name="line-294"></a><span class='hs-definition'>replicate</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Monad</span> <span class='hs-varid'>m</span> <span class='hs-keyglyph'>=></span> <span class='hs-conid'>Integer</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>a</span>
<a name="line-295"></a> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Enumerator</span> <span class='hs-varid'>a</span> <span class='hs-varid'>m</span> <span class='hs-varid'>b</span>
<a name="line-296"></a><span class='hs-definition'>replicate</span> <span class='hs-varid'>maxCount</span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>replicateM</span> <span class='hs-varid'>maxCount</span> <span class='hs-layout'>(</span><span class='hs-varid'>return</span> <span class='hs-varid'>a</span><span class='hs-layout'>)</span>
<a name="line-297"></a>
<a name="line-298"></a><a name="generateM"></a><span class='hs-comment'>-- | Like 'repeatM', except the computation may terminate the stream by</span>
<a name="line-299"></a><span class='hs-comment'>-- returning 'Nothing'.</span>
<a name="line-300"></a><span class='hs-comment'>--</span>
<a name="line-301"></a><span class='hs-comment'>-- Since: 0.4.8</span>
<a name="line-302"></a><span class='hs-definition'>generateM</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Monad</span> <span class='hs-varid'>m</span> <span class='hs-keyglyph'>=></span> <span class='hs-varid'>m</span> <span class='hs-layout'>(</span><span class='hs-conid'>Maybe</span> <span class='hs-varid'>a</span><span class='hs-layout'>)</span>
<a name="line-303"></a> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Enumerator</span> <span class='hs-varid'>a</span> <span class='hs-varid'>m</span> <span class='hs-varid'>b</span>
<a name="line-304"></a><span class='hs-definition'>generateM</span> <span class='hs-varid'>getNext</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>checkContinue0</span> <span class='hs-varop'>$</span> <span class='hs-keyglyph'>\</span><span class='hs-varid'>loop</span> <span class='hs-varid'>k</span> <span class='hs-keyglyph'>-></span> <span class='hs-keyword'>do</span>
<a name="line-305"></a> <span class='hs-varid'>next</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>lift</span> <span class='hs-varid'>getNext</span>
<a name="line-306"></a> <span class='hs-keyword'>case</span> <span class='hs-varid'>next</span> <span class='hs-keyword'>of</span>
<a name="line-307"></a> <span class='hs-conid'>Nothing</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>continue</span> <span class='hs-varid'>k</span>
<a name="line-308"></a> <span class='hs-conid'>Just</span> <span class='hs-varid'>x</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>k</span> <span class='hs-layout'>(</span><span class='hs-conid'>Chunks</span> <span class='hs-keyglyph'>[</span><span class='hs-varid'>x</span><span class='hs-keyglyph'>]</span><span class='hs-layout'>)</span> <span class='hs-varop'>>>==</span> <span class='hs-varid'>loop</span>
<a name="line-309"></a>
<a name="line-310"></a><a name="filter"></a><span class='hs-comment'>-- | Applies a predicate to the stream. The inner iteratee only receives</span>
<a name="line-311"></a><span class='hs-comment'>-- elements for which the predicate is @True@.</span>
<a name="line-312"></a><span class='hs-comment'>--</span>
<a name="line-313"></a><span class='hs-comment'>-- Since: 0.4.8</span>
<a name="line-314"></a><span class='hs-definition'>filter</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Monad</span> <span class='hs-varid'>m</span> <span class='hs-keyglyph'>=></span> <span class='hs-layout'>(</span><span class='hs-varid'>a</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Bool</span><span class='hs-layout'>)</span>
<a name="line-315"></a> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Enumeratee</span> <span class='hs-varid'>a</span> <span class='hs-varid'>a</span> <span class='hs-varid'>m</span> <span class='hs-varid'>b</span>
<a name="line-316"></a><span class='hs-definition'>filter</span> <span class='hs-varid'>p</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>Enumerator</span><span class='hs-varop'>.</span><span class='hs-conid'>List</span><span class='hs-varop'>.</span><span class='hs-varid'>concatMap</span> <span class='hs-layout'>(</span><span class='hs-keyglyph'>\</span><span class='hs-varid'>x</span> <span class='hs-keyglyph'>-></span> <span class='hs-keyglyph'>[</span><span class='hs-varid'>x</span> <span class='hs-keyglyph'>|</span> <span class='hs-varid'>p</span> <span class='hs-varid'>x</span><span class='hs-keyglyph'>]</span><span class='hs-layout'>)</span>
<a name="line-317"></a>
<a name="line-318"></a><a name="filterM"></a><span class='hs-comment'>-- | Applies a monadic predicate to the stream. The inner iteratee only</span>
<a name="line-319"></a><span class='hs-comment'>-- receives elements for which the predicate returns @True@.</span>
<a name="line-320"></a><span class='hs-comment'>--</span>
<a name="line-321"></a><span class='hs-comment'>-- Since: 0.4.8</span>
<a name="line-322"></a><span class='hs-definition'>filterM</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Monad</span> <span class='hs-varid'>m</span> <span class='hs-keyglyph'>=></span> <span class='hs-layout'>(</span><span class='hs-varid'>a</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>m</span> <span class='hs-conid'>Bool</span><span class='hs-layout'>)</span>
<a name="line-323"></a> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Enumeratee</span> <span class='hs-varid'>a</span> <span class='hs-varid'>a</span> <span class='hs-varid'>m</span> <span class='hs-varid'>b</span>
<a name="line-324"></a><span class='hs-definition'>filterM</span> <span class='hs-varid'>p</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>concatMapM</span> <span class='hs-layout'>(</span><span class='hs-keyglyph'>\</span><span class='hs-varid'>x</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>CM</span><span class='hs-varop'>.</span><span class='hs-varid'>filterM</span> <span class='hs-varid'>p</span> <span class='hs-keyglyph'>[</span><span class='hs-varid'>x</span><span class='hs-keyglyph'>]</span><span class='hs-layout'>)</span>
<a name="line-325"></a>
<a name="line-326"></a><a name="take"></a><span class='hs-comment'>-- | @'Data.Enumerator.List.take' n@ extracts the next /n/ elements from the</span>
<a name="line-327"></a><span class='hs-comment'>-- stream, as a list.</span>
<a name="line-328"></a><span class='hs-comment'>--</span>
<a name="line-329"></a><span class='hs-comment'>-- Since: 0.4.5</span>
<a name="line-330"></a><span class='hs-definition'>take</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Monad</span> <span class='hs-varid'>m</span> <span class='hs-keyglyph'>=></span> <span class='hs-conid'>Integer</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Iteratee</span> <span class='hs-varid'>a</span> <span class='hs-varid'>m</span> <span class='hs-keyglyph'>[</span><span class='hs-varid'>a</span><span class='hs-keyglyph'>]</span>
<a name="line-331"></a><span class='hs-definition'>take</span> <span class='hs-varid'>n</span> <span class='hs-keyglyph'>|</span> <span class='hs-varid'>n</span> <span class='hs-varop'><=</span> <span class='hs-num'>0</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>return</span> <span class='hs-conid'>[]</span>
<a name="line-332"></a><span class='hs-definition'>take</span> <span class='hs-varid'>n</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>continue</span> <span class='hs-layout'>(</span><span class='hs-varid'>loop</span> <span class='hs-varid'>id</span> <span class='hs-varid'>n</span><span class='hs-layout'>)</span> <span class='hs-keyword'>where</span>
<a name="line-333"></a> <span class='hs-varid'>len</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>L</span><span class='hs-varop'>.</span><span class='hs-varid'>genericLength</span>
<a name="line-334"></a> <span class='hs-varid'>loop</span> <span class='hs-varid'>acc</span> <span class='hs-varid'>n'</span> <span class='hs-layout'>(</span><span class='hs-conid'>Chunks</span> <span class='hs-varid'>xs</span><span class='hs-layout'>)</span>
<a name="line-335"></a> <span class='hs-keyglyph'>|</span> <span class='hs-varid'>len</span> <span class='hs-varid'>xs</span> <span class='hs-varop'><</span> <span class='hs-varid'>n'</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>continue</span> <span class='hs-layout'>(</span><span class='hs-varid'>loop</span> <span class='hs-layout'>(</span><span class='hs-varid'>acc</span> <span class='hs-varop'>.</span> <span class='hs-layout'>(</span><span class='hs-varid'>xs</span> <span class='hs-varop'>++</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span> <span class='hs-layout'>(</span><span class='hs-varid'>n'</span> <span class='hs-comment'>-</span> <span class='hs-varid'>len</span> <span class='hs-varid'>xs</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span>
<a name="line-336"></a> <span class='hs-keyglyph'>|</span> <span class='hs-varid'>otherwise</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>let</span>
<a name="line-337"></a> <span class='hs-layout'>(</span><span class='hs-varid'>xs'</span><span class='hs-layout'>,</span> <span class='hs-varid'>extra</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>L</span><span class='hs-varop'>.</span><span class='hs-varid'>genericSplitAt</span> <span class='hs-varid'>n'</span> <span class='hs-varid'>xs</span>
<a name="line-338"></a> <span class='hs-keyword'>in</span> <span class='hs-varid'>yield</span> <span class='hs-layout'>(</span><span class='hs-varid'>acc</span> <span class='hs-varid'>xs'</span><span class='hs-layout'>)</span> <span class='hs-layout'>(</span><span class='hs-conid'>Chunks</span> <span class='hs-varid'>extra</span><span class='hs-layout'>)</span>
<a name="line-339"></a> <span class='hs-varid'>loop</span> <span class='hs-varid'>acc</span> <span class='hs-keyword'>_</span> <span class='hs-conid'>EOF</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>yield</span> <span class='hs-layout'>(</span><span class='hs-varid'>acc</span> <span class='hs-conid'>[]</span><span class='hs-layout'>)</span> <span class='hs-conid'>EOF</span>
<a name="line-340"></a>
<a name="line-341"></a><a name="takeWhile"></a><span class='hs-comment'>-- | @'takeWhile' p@ extracts input from the stream until the first element</span>
<a name="line-342"></a><span class='hs-comment'>-- which does not match the predicate.</span>
<a name="line-343"></a><span class='hs-comment'>--</span>
<a name="line-344"></a><span class='hs-comment'>-- Since: 0.4.5</span>
<a name="line-345"></a><span class='hs-definition'>takeWhile</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Monad</span> <span class='hs-varid'>m</span> <span class='hs-keyglyph'>=></span> <span class='hs-layout'>(</span><span class='hs-varid'>a</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Bool</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Iteratee</span> <span class='hs-varid'>a</span> <span class='hs-varid'>m</span> <span class='hs-keyglyph'>[</span><span class='hs-varid'>a</span><span class='hs-keyglyph'>]</span>
<a name="line-346"></a><span class='hs-definition'>takeWhile</span> <span class='hs-varid'>p</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>continue</span> <span class='hs-layout'>(</span><span class='hs-varid'>loop</span> <span class='hs-varid'>id</span><span class='hs-layout'>)</span> <span class='hs-keyword'>where</span>
<a name="line-347"></a> <span class='hs-varid'>loop</span> <span class='hs-varid'>acc</span> <span class='hs-layout'>(</span><span class='hs-conid'>Chunks</span> <span class='hs-conid'>[]</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>continue</span> <span class='hs-layout'>(</span><span class='hs-varid'>loop</span> <span class='hs-varid'>acc</span><span class='hs-layout'>)</span>
<a name="line-348"></a> <span class='hs-varid'>loop</span> <span class='hs-varid'>acc</span> <span class='hs-layout'>(</span><span class='hs-conid'>Chunks</span> <span class='hs-varid'>xs</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>case</span> <span class='hs-conid'>Prelude</span><span class='hs-varop'>.</span><span class='hs-varid'>span</span> <span class='hs-varid'>p</span> <span class='hs-varid'>xs</span> <span class='hs-keyword'>of</span>
<a name="line-349"></a> <span class='hs-layout'>(</span><span class='hs-keyword'>_</span><span class='hs-layout'>,</span> <span class='hs-conid'>[]</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>continue</span> <span class='hs-layout'>(</span><span class='hs-varid'>loop</span> <span class='hs-layout'>(</span><span class='hs-varid'>acc</span> <span class='hs-varop'>.</span> <span class='hs-layout'>(</span><span class='hs-varid'>xs</span> <span class='hs-varop'>++</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span>
<a name="line-350"></a> <span class='hs-layout'>(</span><span class='hs-varid'>xs'</span><span class='hs-layout'>,</span> <span class='hs-varid'>extra</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>yield</span> <span class='hs-layout'>(</span><span class='hs-varid'>acc</span> <span class='hs-varid'>xs'</span><span class='hs-layout'>)</span> <span class='hs-layout'>(</span><span class='hs-conid'>Chunks</span> <span class='hs-varid'>extra</span><span class='hs-layout'>)</span>
<a name="line-351"></a> <span class='hs-varid'>loop</span> <span class='hs-varid'>acc</span> <span class='hs-conid'>EOF</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>yield</span> <span class='hs-layout'>(</span><span class='hs-varid'>acc</span> <span class='hs-conid'>[]</span><span class='hs-layout'>)</span> <span class='hs-conid'>EOF</span>
<a name="line-352"></a>
<a name="line-353"></a><a name="consume"></a><span class='hs-comment'>-- | @'consume' = 'takeWhile' (const True)@</span>
<a name="line-354"></a><span class='hs-comment'>--</span>
<a name="line-355"></a><span class='hs-comment'>-- Since: 0.4.5</span>
<a name="line-356"></a><span class='hs-definition'>consume</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Monad</span> <span class='hs-varid'>m</span> <span class='hs-keyglyph'>=></span> <span class='hs-conid'>Iteratee</span> <span class='hs-varid'>a</span> <span class='hs-varid'>m</span> <span class='hs-keyglyph'>[</span><span class='hs-varid'>a</span><span class='hs-keyglyph'>]</span>
<a name="line-357"></a><span class='hs-definition'>consume</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>continue</span> <span class='hs-layout'>(</span><span class='hs-varid'>loop</span> <span class='hs-varid'>id</span><span class='hs-layout'>)</span> <span class='hs-keyword'>where</span>
<a name="line-358"></a> <span class='hs-varid'>loop</span> <span class='hs-varid'>acc</span> <span class='hs-layout'>(</span><span class='hs-conid'>Chunks</span> <span class='hs-conid'>[]</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>continue</span> <span class='hs-layout'>(</span><span class='hs-varid'>loop</span> <span class='hs-varid'>acc</span><span class='hs-layout'>)</span>
<a name="line-359"></a> <span class='hs-varid'>loop</span> <span class='hs-varid'>acc</span> <span class='hs-layout'>(</span><span class='hs-conid'>Chunks</span> <span class='hs-varid'>xs</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>continue</span> <span class='hs-layout'>(</span><span class='hs-varid'>loop</span> <span class='hs-layout'>(</span><span class='hs-varid'>acc</span> <span class='hs-varop'>.</span> <span class='hs-layout'>(</span><span class='hs-varid'>xs</span> <span class='hs-varop'>++</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span>
<a name="line-360"></a> <span class='hs-varid'>loop</span> <span class='hs-varid'>acc</span> <span class='hs-conid'>EOF</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>yield</span> <span class='hs-layout'>(</span><span class='hs-varid'>acc</span> <span class='hs-conid'>[]</span><span class='hs-layout'>)</span> <span class='hs-conid'>EOF</span>
<a name="line-361"></a>
<a name="line-362"></a><a name="zip"></a><span class='hs-comment'>-- | Pass input from a stream through two iteratees at once. Excess input is</span>
<a name="line-363"></a><span class='hs-comment'>-- yielded if it was not consumed by either iteratee.</span>
<a name="line-364"></a><span class='hs-comment'>--</span>
<a name="line-365"></a><span class='hs-comment'>-- Analogous to 'Data.List.zip'.</span>
<a name="line-366"></a><span class='hs-comment'>--</span>
<a name="line-367"></a><span class='hs-comment'>-- Since: 0.4.14</span>
<a name="line-368"></a><span class='hs-definition'>zip</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Monad</span> <span class='hs-varid'>m</span>
<a name="line-369"></a> <span class='hs-keyglyph'>=></span> <span class='hs-conid'>Iteratee</span> <span class='hs-varid'>a</span> <span class='hs-varid'>m</span> <span class='hs-varid'>b1</span>
<a name="line-370"></a> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Iteratee</span> <span class='hs-varid'>a</span> <span class='hs-varid'>m</span> <span class='hs-varid'>b2</span>
<a name="line-371"></a> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Iteratee</span> <span class='hs-varid'>a</span> <span class='hs-varid'>m</span> <span class='hs-layout'>(</span><span class='hs-varid'>b1</span><span class='hs-layout'>,</span> <span class='hs-varid'>b2</span><span class='hs-layout'>)</span>
<a name="line-372"></a><span class='hs-definition'>zip</span> <span class='hs-varid'>i1</span> <span class='hs-varid'>i2</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>continue</span> <span class='hs-varid'>step</span> <span class='hs-keyword'>where</span>
<a name="line-373"></a> <span class='hs-varid'>step</span> <span class='hs-layout'>(</span><span class='hs-conid'>Chunks</span> <span class='hs-conid'>[]</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>continue</span> <span class='hs-varid'>step</span>
<a name="line-374"></a> <span class='hs-varid'>step</span> <span class='hs-varid'>stream</span><span class='hs-keyglyph'>@</span><span class='hs-layout'>(</span><span class='hs-conid'>Chunks</span> <span class='hs-keyword'>_</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>do</span>
<a name="line-375"></a> <span class='hs-keyword'>let</span> <span class='hs-varid'>enumStream</span> <span class='hs-varid'>s</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>case</span> <span class='hs-varid'>s</span> <span class='hs-keyword'>of</span>
<a name="line-376"></a> <span class='hs-conid'>Continue</span> <span class='hs-varid'>k</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>k</span> <span class='hs-varid'>stream</span>
<a name="line-377"></a> <span class='hs-conid'>Yield</span> <span class='hs-varid'>b</span> <span class='hs-varid'>extra</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>yield</span> <span class='hs-varid'>b</span> <span class='hs-layout'>(</span><span class='hs-varid'>mappend</span> <span class='hs-varid'>extra</span> <span class='hs-varid'>stream</span><span class='hs-layout'>)</span>
<a name="line-378"></a> <span class='hs-conid'>Error</span> <span class='hs-varid'>err</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>throwError</span> <span class='hs-varid'>err</span>
<a name="line-379"></a>
<a name="line-380"></a> <span class='hs-varid'>s1</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>lift</span> <span class='hs-layout'>(</span><span class='hs-varid'>runIteratee</span> <span class='hs-layout'>(</span><span class='hs-varid'>enumStream</span> <span class='hs-varop'>==<<</span> <span class='hs-varid'>i1</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span>
<a name="line-381"></a> <span class='hs-varid'>s2</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>lift</span> <span class='hs-layout'>(</span><span class='hs-varid'>runIteratee</span> <span class='hs-layout'>(</span><span class='hs-varid'>enumStream</span> <span class='hs-varop'>==<<</span> <span class='hs-varid'>i2</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span>
<a name="line-382"></a>
<a name="line-383"></a> <span class='hs-keyword'>case</span> <span class='hs-layout'>(</span><span class='hs-varid'>s1</span><span class='hs-layout'>,</span> <span class='hs-varid'>s2</span><span class='hs-layout'>)</span> <span class='hs-keyword'>of</span>
<a name="line-384"></a> <span class='hs-layout'>(</span><span class='hs-conid'>Continue</span> <span class='hs-varid'>k1</span><span class='hs-layout'>,</span> <span class='hs-conid'>Continue</span> <span class='hs-varid'>k2</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>zip</span> <span class='hs-layout'>(</span><span class='hs-varid'>continue</span> <span class='hs-varid'>k1</span><span class='hs-layout'>)</span> <span class='hs-layout'>(</span><span class='hs-varid'>continue</span> <span class='hs-varid'>k2</span><span class='hs-layout'>)</span>
<a name="line-385"></a> <span class='hs-layout'>(</span><span class='hs-conid'>Yield</span> <span class='hs-varid'>b1</span> <span class='hs-keyword'>_</span><span class='hs-layout'>,</span> <span class='hs-conid'>Continue</span> <span class='hs-varid'>k2</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>zip</span> <span class='hs-layout'>(</span><span class='hs-varid'>yield</span> <span class='hs-varid'>b1</span> <span class='hs-layout'>(</span><span class='hs-conid'>Chunks</span> <span class='hs-conid'>[]</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span> <span class='hs-layout'>(</span><span class='hs-varid'>continue</span> <span class='hs-varid'>k2</span><span class='hs-layout'>)</span>
<a name="line-386"></a> <span class='hs-layout'>(</span><span class='hs-conid'>Continue</span> <span class='hs-varid'>k1</span><span class='hs-layout'>,</span> <span class='hs-conid'>Yield</span> <span class='hs-varid'>b2</span> <span class='hs-keyword'>_</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>zip</span> <span class='hs-layout'>(</span><span class='hs-varid'>continue</span> <span class='hs-varid'>k1</span><span class='hs-layout'>)</span> <span class='hs-layout'>(</span><span class='hs-varid'>yield</span> <span class='hs-varid'>b2</span> <span class='hs-layout'>(</span><span class='hs-conid'>Chunks</span> <span class='hs-conid'>[]</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span>
<a name="line-387"></a> <span class='hs-layout'>(</span><span class='hs-conid'>Yield</span> <span class='hs-varid'>b1</span> <span class='hs-varid'>ex1</span><span class='hs-layout'>,</span> <span class='hs-conid'>Yield</span> <span class='hs-varid'>b2</span> <span class='hs-varid'>ex2</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>yield</span> <span class='hs-layout'>(</span><span class='hs-varid'>b1</span><span class='hs-layout'>,</span> <span class='hs-varid'>b2</span><span class='hs-layout'>)</span> <span class='hs-layout'>(</span><span class='hs-varid'>shorter</span> <span class='hs-varid'>ex1</span> <span class='hs-varid'>ex2</span><span class='hs-layout'>)</span>
<a name="line-388"></a> <span class='hs-layout'>(</span><span class='hs-conid'>Error</span> <span class='hs-varid'>err</span><span class='hs-layout'>,</span> <span class='hs-keyword'>_</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>throwError</span> <span class='hs-varid'>err</span>
<a name="line-389"></a> <span class='hs-layout'>(</span><span class='hs-keyword'>_</span><span class='hs-layout'>,</span> <span class='hs-conid'>Error</span> <span class='hs-varid'>err</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>throwError</span> <span class='hs-varid'>err</span>
<a name="line-390"></a>
<a name="line-391"></a> <span class='hs-varid'>step</span> <span class='hs-conid'>EOF</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>do</span>
<a name="line-392"></a> <span class='hs-varid'>b1</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>enumEOF</span> <span class='hs-varop'>=<<</span> <span class='hs-varid'>lift</span> <span class='hs-layout'>(</span><span class='hs-varid'>runIteratee</span> <span class='hs-varid'>i1</span><span class='hs-layout'>)</span>
<a name="line-393"></a> <span class='hs-varid'>b2</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>enumEOF</span> <span class='hs-varop'>=<<</span> <span class='hs-varid'>lift</span> <span class='hs-layout'>(</span><span class='hs-varid'>runIteratee</span> <span class='hs-varid'>i2</span><span class='hs-layout'>)</span>
<a name="line-394"></a> <span class='hs-varid'>return</span> <span class='hs-layout'>(</span><span class='hs-varid'>b1</span><span class='hs-layout'>,</span> <span class='hs-varid'>b2</span><span class='hs-layout'>)</span>
<a name="line-395"></a>
<a name="line-396"></a> <span class='hs-varid'>shorter</span> <span class='hs-varid'>c1</span><span class='hs-keyglyph'>@</span><span class='hs-layout'>(</span><span class='hs-conid'>Chunks</span> <span class='hs-varid'>xs</span><span class='hs-layout'>)</span> <span class='hs-varid'>c2</span><span class='hs-keyglyph'>@</span><span class='hs-layout'>(</span><span class='hs-conid'>Chunks</span> <span class='hs-varid'>ys</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>if</span> <span class='hs-varid'>length</span> <span class='hs-varid'>xs</span> <span class='hs-varop'><</span> <span class='hs-varid'>length</span> <span class='hs-varid'>ys</span>
<a name="line-397"></a> <span class='hs-keyword'>then</span> <span class='hs-varid'>c1</span>
<a name="line-398"></a> <span class='hs-keyword'>else</span> <span class='hs-varid'>c2</span>
<a name="line-399"></a> <span class='hs-varid'>shorter</span> <span class='hs-keyword'>_</span> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>EOF</span>
<a name="line-400"></a>
<a name="line-401"></a><a name="zip3"></a><span class='hs-comment'>-- | Pass input from a stream through three iteratees at once. Excess input is</span>
<a name="line-402"></a><span class='hs-comment'>-- yielded if it was not consumed by any iteratee.</span>
<a name="line-403"></a><span class='hs-comment'>--</span>
<a name="line-404"></a><span class='hs-comment'>-- Analogous to 'Data.List.zip3'.</span>
<a name="line-405"></a><span class='hs-comment'>--</span>
<a name="line-406"></a><span class='hs-comment'>-- Since: 0.4.14</span>
<a name="line-407"></a><span class='hs-definition'>zip3</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Monad</span> <span class='hs-varid'>m</span>
<a name="line-408"></a> <span class='hs-keyglyph'>=></span> <span class='hs-conid'>Iteratee</span> <span class='hs-varid'>a</span> <span class='hs-varid'>m</span> <span class='hs-varid'>b1</span>
<a name="line-409"></a> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Iteratee</span> <span class='hs-varid'>a</span> <span class='hs-varid'>m</span> <span class='hs-varid'>b2</span>
<a name="line-410"></a> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Iteratee</span> <span class='hs-varid'>a</span> <span class='hs-varid'>m</span> <span class='hs-varid'>b3</span>
<a name="line-411"></a> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Iteratee</span> <span class='hs-varid'>a</span> <span class='hs-varid'>m</span> <span class='hs-layout'>(</span><span class='hs-varid'>b1</span><span class='hs-layout'>,</span> <span class='hs-varid'>b2</span><span class='hs-layout'>,</span> <span class='hs-varid'>b3</span><span class='hs-layout'>)</span>
<a name="line-412"></a><span class='hs-definition'>zip3</span> <span class='hs-varid'>i1</span> <span class='hs-varid'>i2</span> <span class='hs-varid'>i3</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>do</span>
<a name="line-413"></a> <span class='hs-layout'>(</span><span class='hs-varid'>b1</span><span class='hs-layout'>,</span> <span class='hs-layout'>(</span><span class='hs-varid'>b2</span><span class='hs-layout'>,</span> <span class='hs-varid'>b3</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>zip</span> <span class='hs-varid'>i1</span> <span class='hs-layout'>(</span><span class='hs-varid'>zip</span> <span class='hs-varid'>i2</span> <span class='hs-varid'>i3</span><span class='hs-layout'>)</span>
<a name="line-414"></a> <span class='hs-varid'>return</span> <span class='hs-layout'>(</span><span class='hs-varid'>b1</span><span class='hs-layout'>,</span> <span class='hs-varid'>b2</span><span class='hs-layout'>,</span> <span class='hs-varid'>b3</span><span class='hs-layout'>)</span>
<a name="line-415"></a><span class='hs-comment'>{-# INLINE zip3 #-}</span>
<a name="line-416"></a>
<a name="line-417"></a><a name="zip4"></a><span class='hs-comment'>-- | Pass input from a stream through four iteratees at once. Excess input is</span>
<a name="line-418"></a><span class='hs-comment'>-- yielded if it was not consumed by any iteratee.</span>
<a name="line-419"></a><span class='hs-comment'>--</span>
<a name="line-420"></a><span class='hs-comment'>-- Analogous to 'Data.List.zip4'.</span>
<a name="line-421"></a><span class='hs-comment'>--</span>
<a name="line-422"></a><span class='hs-comment'>-- Since: 0.4.14</span>
<a name="line-423"></a><span class='hs-definition'>zip4</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Monad</span> <span class='hs-varid'>m</span>
<a name="line-424"></a> <span class='hs-keyglyph'>=></span> <span class='hs-conid'>Iteratee</span> <span class='hs-varid'>a</span> <span class='hs-varid'>m</span> <span class='hs-varid'>b1</span>
<a name="line-425"></a> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Iteratee</span> <span class='hs-varid'>a</span> <span class='hs-varid'>m</span> <span class='hs-varid'>b2</span>
<a name="line-426"></a> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Iteratee</span> <span class='hs-varid'>a</span> <span class='hs-varid'>m</span> <span class='hs-varid'>b3</span>
<a name="line-427"></a> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Iteratee</span> <span class='hs-varid'>a</span> <span class='hs-varid'>m</span> <span class='hs-varid'>b4</span>
<a name="line-428"></a> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Iteratee</span> <span class='hs-varid'>a</span> <span class='hs-varid'>m</span> <span class='hs-layout'>(</span><span class='hs-varid'>b1</span><span class='hs-layout'>,</span> <span class='hs-varid'>b2</span><span class='hs-layout'>,</span> <span class='hs-varid'>b3</span><span class='hs-layout'>,</span> <span class='hs-varid'>b4</span><span class='hs-layout'>)</span>
<a name="line-429"></a><span class='hs-definition'>zip4</span> <span class='hs-varid'>i1</span> <span class='hs-varid'>i2</span> <span class='hs-varid'>i3</span> <span class='hs-varid'>i4</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>do</span>
<a name="line-430"></a> <span class='hs-layout'>(</span><span class='hs-varid'>b1</span><span class='hs-layout'>,</span> <span class='hs-layout'>(</span><span class='hs-varid'>b2</span><span class='hs-layout'>,</span> <span class='hs-varid'>b3</span><span class='hs-layout'>,</span> <span class='hs-varid'>b4</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>zip</span> <span class='hs-varid'>i1</span> <span class='hs-layout'>(</span><span class='hs-varid'>zip3</span> <span class='hs-varid'>i2</span> <span class='hs-varid'>i3</span> <span class='hs-varid'>i4</span><span class='hs-layout'>)</span>
<a name="line-431"></a> <span class='hs-varid'>return</span> <span class='hs-layout'>(</span><span class='hs-varid'>b1</span><span class='hs-layout'>,</span> <span class='hs-varid'>b2</span><span class='hs-layout'>,</span> <span class='hs-varid'>b3</span><span class='hs-layout'>,</span> <span class='hs-varid'>b4</span><span class='hs-layout'>)</span>
<a name="line-432"></a><span class='hs-comment'>{-# INLINE zip4 #-}</span>
<a name="line-433"></a>
<a name="line-434"></a><a name="zip5"></a><span class='hs-comment'>-- | Pass input from a stream through five iteratees at once. Excess input is</span>
<a name="line-435"></a><span class='hs-comment'>-- yielded if it was not consumed by any iteratee.</span>
<a name="line-436"></a><span class='hs-comment'>--</span>
<a name="line-437"></a><span class='hs-comment'>-- Analogous to 'Data.List.zip5'.</span>
<a name="line-438"></a><span class='hs-comment'>--</span>
<a name="line-439"></a><span class='hs-comment'>-- Since: 0.4.14</span>
<a name="line-440"></a><span class='hs-definition'>zip5</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Monad</span> <span class='hs-varid'>m</span>
<a name="line-441"></a> <span class='hs-keyglyph'>=></span> <span class='hs-conid'>Iteratee</span> <span class='hs-varid'>a</span> <span class='hs-varid'>m</span> <span class='hs-varid'>b1</span>
<a name="line-442"></a> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Iteratee</span> <span class='hs-varid'>a</span> <span class='hs-varid'>m</span> <span class='hs-varid'>b2</span>
<a name="line-443"></a> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Iteratee</span> <span class='hs-varid'>a</span> <span class='hs-varid'>m</span> <span class='hs-varid'>b3</span>
<a name="line-444"></a> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Iteratee</span> <span class='hs-varid'>a</span> <span class='hs-varid'>m</span> <span class='hs-varid'>b4</span>
<a name="line-445"></a> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Iteratee</span> <span class='hs-varid'>a</span> <span class='hs-varid'>m</span> <span class='hs-varid'>b5</span>
<a name="line-446"></a> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Iteratee</span> <span class='hs-varid'>a</span> <span class='hs-varid'>m</span> <span class='hs-layout'>(</span><span class='hs-varid'>b1</span><span class='hs-layout'>,</span> <span class='hs-varid'>b2</span><span class='hs-layout'>,</span> <span class='hs-varid'>b3</span><span class='hs-layout'>,</span> <span class='hs-varid'>b4</span><span class='hs-layout'>,</span> <span class='hs-varid'>b5</span><span class='hs-layout'>)</span>
<a name="line-447"></a><span class='hs-definition'>zip5</span> <span class='hs-varid'>i1</span> <span class='hs-varid'>i2</span> <span class='hs-varid'>i3</span> <span class='hs-varid'>i4</span> <span class='hs-varid'>i5</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>do</span>
<a name="line-448"></a> <span class='hs-layout'>(</span><span class='hs-varid'>b1</span><span class='hs-layout'>,</span> <span class='hs-layout'>(</span><span class='hs-varid'>b2</span><span class='hs-layout'>,</span> <span class='hs-varid'>b3</span><span class='hs-layout'>,</span> <span class='hs-varid'>b4</span><span class='hs-layout'>,</span> <span class='hs-varid'>b5</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>zip</span> <span class='hs-varid'>i1</span> <span class='hs-layout'>(</span><span class='hs-varid'>zip4</span> <span class='hs-varid'>i2</span> <span class='hs-varid'>i3</span> <span class='hs-varid'>i4</span> <span class='hs-varid'>i5</span><span class='hs-layout'>)</span>
<a name="line-449"></a> <span class='hs-varid'>return</span> <span class='hs-layout'>(</span><span class='hs-varid'>b1</span><span class='hs-layout'>,</span> <span class='hs-varid'>b2</span><span class='hs-layout'>,</span> <span class='hs-varid'>b3</span><span class='hs-layout'>,</span> <span class='hs-varid'>b4</span><span class='hs-layout'>,</span> <span class='hs-varid'>b5</span><span class='hs-layout'>)</span>
<a name="line-450"></a><span class='hs-comment'>{-# INLINE zip5 #-}</span>
<a name="line-451"></a>
<a name="line-452"></a><a name="zip6"></a><span class='hs-comment'>-- | Pass input from a stream through six iteratees at once. Excess input is</span>
<a name="line-453"></a><span class='hs-comment'>-- yielded if it was not consumed by any iteratee.</span>
<a name="line-454"></a><span class='hs-comment'>--</span>
<a name="line-455"></a><span class='hs-comment'>-- Analogous to 'Data.List.zip6'.</span>
<a name="line-456"></a><span class='hs-comment'>--</span>
<a name="line-457"></a><span class='hs-comment'>-- Since: 0.4.14</span>
<a name="line-458"></a><span class='hs-definition'>zip6</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Monad</span> <span class='hs-varid'>m</span>
<a name="line-459"></a> <span class='hs-keyglyph'>=></span> <span class='hs-conid'>Iteratee</span> <span class='hs-varid'>a</span> <span class='hs-varid'>m</span> <span class='hs-varid'>b1</span>
<a name="line-460"></a> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Iteratee</span> <span class='hs-varid'>a</span> <span class='hs-varid'>m</span> <span class='hs-varid'>b2</span>
<a name="line-461"></a> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Iteratee</span> <span class='hs-varid'>a</span> <span class='hs-varid'>m</span> <span class='hs-varid'>b3</span>
<a name="line-462"></a> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Iteratee</span> <span class='hs-varid'>a</span> <span class='hs-varid'>m</span> <span class='hs-varid'>b4</span>
<a name="line-463"></a> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Iteratee</span> <span class='hs-varid'>a</span> <span class='hs-varid'>m</span> <span class='hs-varid'>b5</span>
<a name="line-464"></a> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Iteratee</span> <span class='hs-varid'>a</span> <span class='hs-varid'>m</span> <span class='hs-varid'>b6</span>
<a name="line-465"></a> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Iteratee</span> <span class='hs-varid'>a</span> <span class='hs-varid'>m</span> <span class='hs-layout'>(</span><span class='hs-varid'>b1</span><span class='hs-layout'>,</span> <span class='hs-varid'>b2</span><span class='hs-layout'>,</span> <span class='hs-varid'>b3</span><span class='hs-layout'>,</span> <span class='hs-varid'>b4</span><span class='hs-layout'>,</span> <span class='hs-varid'>b5</span><span class='hs-layout'>,</span> <span class='hs-varid'>b6</span><span class='hs-layout'>)</span>
<a name="line-466"></a><span class='hs-definition'>zip6</span> <span class='hs-varid'>i1</span> <span class='hs-varid'>i2</span> <span class='hs-varid'>i3</span> <span class='hs-varid'>i4</span> <span class='hs-varid'>i5</span> <span class='hs-varid'>i6</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>do</span>
<a name="line-467"></a> <span class='hs-layout'>(</span><span class='hs-varid'>b1</span><span class='hs-layout'>,</span> <span class='hs-layout'>(</span><span class='hs-varid'>b2</span><span class='hs-layout'>,</span> <span class='hs-varid'>b3</span><span class='hs-layout'>,</span> <span class='hs-varid'>b4</span><span class='hs-layout'>,</span> <span class='hs-varid'>b5</span><span class='hs-layout'>,</span> <span class='hs-varid'>b6</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>zip</span> <span class='hs-varid'>i1</span> <span class='hs-layout'>(</span><span class='hs-varid'>zip5</span> <span class='hs-varid'>i2</span> <span class='hs-varid'>i3</span> <span class='hs-varid'>i4</span> <span class='hs-varid'>i5</span> <span class='hs-varid'>i6</span><span class='hs-layout'>)</span>
<a name="line-468"></a> <span class='hs-varid'>return</span> <span class='hs-layout'>(</span><span class='hs-varid'>b1</span><span class='hs-layout'>,</span> <span class='hs-varid'>b2</span><span class='hs-layout'>,</span> <span class='hs-varid'>b3</span><span class='hs-layout'>,</span> <span class='hs-varid'>b4</span><span class='hs-layout'>,</span> <span class='hs-varid'>b5</span><span class='hs-layout'>,</span> <span class='hs-varid'>b6</span><span class='hs-layout'>)</span>
<a name="line-469"></a><span class='hs-comment'>{-# INLINE zip6 #-}</span>
<a name="line-470"></a>
<a name="line-471"></a><a name="zip7"></a><span class='hs-comment'>-- | Pass input from a stream through seven iteratees at once. Excess input is</span>
<a name="line-472"></a><span class='hs-comment'>-- yielded if it was not consumed by any iteratee.</span>
<a name="line-473"></a><span class='hs-comment'>--</span>
<a name="line-474"></a><span class='hs-comment'>-- Analogous to 'Data.List.zip7'.</span>
<a name="line-475"></a><span class='hs-comment'>--</span>
<a name="line-476"></a><span class='hs-comment'>-- Since: 0.4.14</span>
<a name="line-477"></a><span class='hs-definition'>zip7</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Monad</span> <span class='hs-varid'>m</span>
<a name="line-478"></a> <span class='hs-keyglyph'>=></span> <span class='hs-conid'>Iteratee</span> <span class='hs-varid'>a</span> <span class='hs-varid'>m</span> <span class='hs-varid'>b1</span>
<a name="line-479"></a> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Iteratee</span> <span class='hs-varid'>a</span> <span class='hs-varid'>m</span> <span class='hs-varid'>b2</span>
<a name="line-480"></a> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Iteratee</span> <span class='hs-varid'>a</span> <span class='hs-varid'>m</span> <span class='hs-varid'>b3</span>
<a name="line-481"></a> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Iteratee</span> <span class='hs-varid'>a</span> <span class='hs-varid'>m</span> <span class='hs-varid'>b4</span>
<a name="line-482"></a> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Iteratee</span> <span class='hs-varid'>a</span> <span class='hs-varid'>m</span> <span class='hs-varid'>b5</span>
<a name="line-483"></a> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Iteratee</span> <span class='hs-varid'>a</span> <span class='hs-varid'>m</span> <span class='hs-varid'>b6</span>
<a name="line-484"></a> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Iteratee</span> <span class='hs-varid'>a</span> <span class='hs-varid'>m</span> <span class='hs-varid'>b7</span>
<a name="line-485"></a> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Iteratee</span> <span class='hs-varid'>a</span> <span class='hs-varid'>m</span> <span class='hs-layout'>(</span><span class='hs-varid'>b1</span><span class='hs-layout'>,</span> <span class='hs-varid'>b2</span><span class='hs-layout'>,</span> <span class='hs-varid'>b3</span><span class='hs-layout'>,</span> <span class='hs-varid'>b4</span><span class='hs-layout'>,</span> <span class='hs-varid'>b5</span><span class='hs-layout'>,</span> <span class='hs-varid'>b6</span><span class='hs-layout'>,</span> <span class='hs-varid'>b7</span><span class='hs-layout'>)</span>
<a name="line-486"></a><span class='hs-definition'>zip7</span> <span class='hs-varid'>i1</span> <span class='hs-varid'>i2</span> <span class='hs-varid'>i3</span> <span class='hs-varid'>i4</span> <span class='hs-varid'>i5</span> <span class='hs-varid'>i6</span> <span class='hs-varid'>i7</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>do</span>
<a name="line-487"></a> <span class='hs-layout'>(</span><span class='hs-varid'>b1</span><span class='hs-layout'>,</span> <span class='hs-layout'>(</span><span class='hs-varid'>b2</span><span class='hs-layout'>,</span> <span class='hs-varid'>b3</span><span class='hs-layout'>,</span> <span class='hs-varid'>b4</span><span class='hs-layout'>,</span> <span class='hs-varid'>b5</span><span class='hs-layout'>,</span> <span class='hs-varid'>b6</span><span class='hs-layout'>,</span> <span class='hs-varid'>b7</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>zip</span> <span class='hs-varid'>i1</span> <span class='hs-layout'>(</span><span class='hs-varid'>zip6</span> <span class='hs-varid'>i2</span> <span class='hs-varid'>i3</span> <span class='hs-varid'>i4</span> <span class='hs-varid'>i5</span> <span class='hs-varid'>i6</span> <span class='hs-varid'>i7</span><span class='hs-layout'>)</span>
<a name="line-488"></a> <span class='hs-varid'>return</span> <span class='hs-layout'>(</span><span class='hs-varid'>b1</span><span class='hs-layout'>,</span> <span class='hs-varid'>b2</span><span class='hs-layout'>,</span> <span class='hs-varid'>b3</span><span class='hs-layout'>,</span> <span class='hs-varid'>b4</span><span class='hs-layout'>,</span> <span class='hs-varid'>b5</span><span class='hs-layout'>,</span> <span class='hs-varid'>b6</span><span class='hs-layout'>,</span> <span class='hs-varid'>b7</span><span class='hs-layout'>)</span>
<a name="line-489"></a><span class='hs-comment'>{-# INLINE zip7 #-}</span>
<a name="line-490"></a>
<a name="line-491"></a><a name="zipWith"></a><span class='hs-comment'>-- | Pass input from a stream through two iteratees at once. Excess input is</span>
<a name="line-492"></a><span class='hs-comment'>-- yielded if it was not consumed by either iteratee. Output from the</span>
<a name="line-493"></a><span class='hs-comment'>-- iteratees is combined with a user-provided function.</span>
<a name="line-494"></a><span class='hs-comment'>--</span>
<a name="line-495"></a><span class='hs-comment'>-- Analogous to 'Data.List.zipWith'.</span>
<a name="line-496"></a><span class='hs-comment'>--</span>
<a name="line-497"></a><span class='hs-comment'>-- Since: 0.4.14</span>
<a name="line-498"></a><span class='hs-definition'>zipWith</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Monad</span> <span class='hs-varid'>m</span>
<a name="line-499"></a> <span class='hs-keyglyph'>=></span> <span class='hs-layout'>(</span><span class='hs-varid'>b1</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>b2</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>c</span><span class='hs-layout'>)</span>
<a name="line-500"></a> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Iteratee</span> <span class='hs-varid'>a</span> <span class='hs-varid'>m</span> <span class='hs-varid'>b1</span>
<a name="line-501"></a> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Iteratee</span> <span class='hs-varid'>a</span> <span class='hs-varid'>m</span> <span class='hs-varid'>b2</span>
<a name="line-502"></a> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Iteratee</span> <span class='hs-varid'>a</span> <span class='hs-varid'>m</span> <span class='hs-varid'>c</span>
<a name="line-503"></a><span class='hs-definition'>zipWith</span> <span class='hs-varid'>f</span> <span class='hs-varid'>i1</span> <span class='hs-varid'>i2</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>do</span>
<a name="line-504"></a> <span class='hs-layout'>(</span><span class='hs-varid'>b1</span><span class='hs-layout'>,</span> <span class='hs-varid'>b2</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>zip</span> <span class='hs-varid'>i1</span> <span class='hs-varid'>i2</span>
<a name="line-505"></a> <span class='hs-varid'>return</span> <span class='hs-layout'>(</span><span class='hs-varid'>f</span> <span class='hs-varid'>b1</span> <span class='hs-varid'>b2</span><span class='hs-layout'>)</span>
<a name="line-506"></a><span class='hs-comment'>{-# INLINE zipWith #-}</span>
<a name="line-507"></a>
<a name="line-508"></a><a name="zipWith3"></a><span class='hs-comment'>-- | Pass input from a stream through two iteratees at once. Excess input is</span>
<a name="line-509"></a><span class='hs-comment'>-- yielded if it was not consumed by either iteratee. Output from the</span>
<a name="line-510"></a><span class='hs-comment'>-- iteratees is combined with a user-provided function.</span>
<a name="line-511"></a><span class='hs-comment'>--</span>
<a name="line-512"></a><span class='hs-comment'>-- Analogous to 'Data.List.zipWith3'.</span>
<a name="line-513"></a><span class='hs-comment'>--</span>
<a name="line-514"></a><span class='hs-comment'>-- Since: 0.4.14</span>
<a name="line-515"></a><span class='hs-definition'>zipWith3</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Monad</span> <span class='hs-varid'>m</span>
<a name="line-516"></a> <span class='hs-keyglyph'>=></span> <span class='hs-layout'>(</span><span class='hs-varid'>b1</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>b2</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>b3</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>c</span><span class='hs-layout'>)</span>
<a name="line-517"></a> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Iteratee</span> <span class='hs-varid'>a</span> <span class='hs-varid'>m</span> <span class='hs-varid'>b1</span>
<a name="line-518"></a> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Iteratee</span> <span class='hs-varid'>a</span> <span class='hs-varid'>m</span> <span class='hs-varid'>b2</span>
<a name="line-519"></a> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Iteratee</span> <span class='hs-varid'>a</span> <span class='hs-varid'>m</span> <span class='hs-varid'>b3</span>
<a name="line-520"></a> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Iteratee</span> <span class='hs-varid'>a</span> <span class='hs-varid'>m</span> <span class='hs-varid'>c</span>
<a name="line-521"></a><span class='hs-definition'>zipWith3</span> <span class='hs-varid'>f</span> <span class='hs-varid'>i1</span> <span class='hs-varid'>i2</span> <span class='hs-varid'>i3</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>do</span>
<a name="line-522"></a> <span class='hs-layout'>(</span><span class='hs-varid'>b1</span><span class='hs-layout'>,</span> <span class='hs-varid'>b2</span><span class='hs-layout'>,</span> <span class='hs-varid'>b3</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>zip3</span> <span class='hs-varid'>i1</span> <span class='hs-varid'>i2</span> <span class='hs-varid'>i3</span>
<a name="line-523"></a> <span class='hs-varid'>return</span> <span class='hs-layout'>(</span><span class='hs-varid'>f</span> <span class='hs-varid'>b1</span> <span class='hs-varid'>b2</span> <span class='hs-varid'>b3</span><span class='hs-layout'>)</span>
<a name="line-524"></a><span class='hs-comment'>{-# INLINE zipWith3 #-}</span>
<a name="line-525"></a>
<a name="line-526"></a><a name="zipWith4"></a><span class='hs-comment'>-- | Pass input from a stream through two iteratees at once. Excess input is</span>
<a name="line-527"></a><span class='hs-comment'>-- yielded if it was not consumed by either iteratee. Output from the</span>
<a name="line-528"></a><span class='hs-comment'>-- iteratees is combined with a user-provided function.</span>
<a name="line-529"></a><span class='hs-comment'>--</span>
<a name="line-530"></a><span class='hs-comment'>-- Analogous to 'Data.List.zipWith4'.</span>
<a name="line-531"></a><span class='hs-comment'>--</span>
<a name="line-532"></a><span class='hs-comment'>-- Since: 0.4.14</span>
<a name="line-533"></a><span class='hs-definition'>zipWith4</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Monad</span> <span class='hs-varid'>m</span>
<a name="line-534"></a> <span class='hs-keyglyph'>=></span> <span class='hs-layout'>(</span><span class='hs-varid'>b1</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>b2</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>b3</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>b4</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>c</span><span class='hs-layout'>)</span>
<a name="line-535"></a> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Iteratee</span> <span class='hs-varid'>a</span> <span class='hs-varid'>m</span> <span class='hs-varid'>b1</span>
<a name="line-536"></a> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Iteratee</span> <span class='hs-varid'>a</span> <span class='hs-varid'>m</span> <span class='hs-varid'>b2</span>
<a name="line-537"></a> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Iteratee</span> <span class='hs-varid'>a</span> <span class='hs-varid'>m</span> <span class='hs-varid'>b3</span>
<a name="line-538"></a> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Iteratee</span> <span class='hs-varid'>a</span> <span class='hs-varid'>m</span> <span class='hs-varid'>b4</span>
<a name="line-539"></a> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Iteratee</span> <span class='hs-varid'>a</span> <span class='hs-varid'>m</span> <span class='hs-varid'>c</span>
<a name="line-540"></a><span class='hs-definition'>zipWith4</span> <span class='hs-varid'>f</span> <span class='hs-varid'>i1</span> <span class='hs-varid'>i2</span> <span class='hs-varid'>i3</span> <span class='hs-varid'>i4</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>do</span>
<a name="line-541"></a> <span class='hs-layout'>(</span><span class='hs-varid'>b1</span><span class='hs-layout'>,</span> <span class='hs-varid'>b2</span><span class='hs-layout'>,</span> <span class='hs-varid'>b3</span><span class='hs-layout'>,</span> <span class='hs-varid'>b4</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>zip4</span> <span class='hs-varid'>i1</span> <span class='hs-varid'>i2</span> <span class='hs-varid'>i3</span> <span class='hs-varid'>i4</span>
<a name="line-542"></a> <span class='hs-varid'>return</span> <span class='hs-layout'>(</span><span class='hs-varid'>f</span> <span class='hs-varid'>b1</span> <span class='hs-varid'>b2</span> <span class='hs-varid'>b3</span> <span class='hs-varid'>b4</span><span class='hs-layout'>)</span>
<a name="line-543"></a><span class='hs-comment'>{-# INLINE zipWith4 #-}</span>
<a name="line-544"></a>
<a name="line-545"></a><a name="zipWith5"></a><span class='hs-comment'>-- | Pass input from a stream through two iteratees at once. Excess input is</span>
<a name="line-546"></a><span class='hs-comment'>-- yielded if it was not consumed by either iteratee. Output from the</span>
<a name="line-547"></a><span class='hs-comment'>-- iteratees is combined with a user-provided function.</span>
<a name="line-548"></a><span class='hs-comment'>--</span>
<a name="line-549"></a><span class='hs-comment'>-- Analogous to 'Data.List.zipWith5'.</span>
<a name="line-550"></a><span class='hs-comment'>--</span>
<a name="line-551"></a><span class='hs-comment'>-- Since: 0.4.14</span>
<a name="line-552"></a><span class='hs-definition'>zipWith5</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Monad</span> <span class='hs-varid'>m</span>
<a name="line-553"></a> <span class='hs-keyglyph'>=></span> <span class='hs-layout'>(</span><span class='hs-varid'>b1</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>b2</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>b3</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>b4</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>b5</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>c</span><span class='hs-layout'>)</span>
<a name="line-554"></a> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Iteratee</span> <span class='hs-varid'>a</span> <span class='hs-varid'>m</span> <span class='hs-varid'>b1</span>
<a name="line-555"></a> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Iteratee</span> <span class='hs-varid'>a</span> <span class='hs-varid'>m</span> <span class='hs-varid'>b2</span>
<a name="line-556"></a> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Iteratee</span> <span class='hs-varid'>a</span> <span class='hs-varid'>m</span> <span class='hs-varid'>b3</span>
<a name="line-557"></a> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Iteratee</span> <span class='hs-varid'>a</span> <span class='hs-varid'>m</span> <span class='hs-varid'>b4</span>
<a name="line-558"></a> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Iteratee</span> <span class='hs-varid'>a</span> <span class='hs-varid'>m</span> <span class='hs-varid'>b5</span>
<a name="line-559"></a> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Iteratee</span> <span class='hs-varid'>a</span> <span class='hs-varid'>m</span> <span class='hs-varid'>c</span>
<a name="line-560"></a><span class='hs-definition'>zipWith5</span> <span class='hs-varid'>f</span> <span class='hs-varid'>i1</span> <span class='hs-varid'>i2</span> <span class='hs-varid'>i3</span> <span class='hs-varid'>i4</span> <span class='hs-varid'>i5</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>do</span>
<a name="line-561"></a> <span class='hs-layout'>(</span><span class='hs-varid'>b1</span><span class='hs-layout'>,</span> <span class='hs-varid'>b2</span><span class='hs-layout'>,</span> <span class='hs-varid'>b3</span><span class='hs-layout'>,</span> <span class='hs-varid'>b4</span><span class='hs-layout'>,</span> <span class='hs-varid'>b5</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>zip5</span> <span class='hs-varid'>i1</span> <span class='hs-varid'>i2</span> <span class='hs-varid'>i3</span> <span class='hs-varid'>i4</span> <span class='hs-varid'>i5</span>
<a name="line-562"></a> <span class='hs-varid'>return</span> <span class='hs-layout'>(</span><span class='hs-varid'>f</span> <span class='hs-varid'>b1</span> <span class='hs-varid'>b2</span> <span class='hs-varid'>b3</span> <span class='hs-varid'>b4</span> <span class='hs-varid'>b5</span><span class='hs-layout'>)</span>
<a name="line-563"></a><span class='hs-comment'>{-# INLINE zipWith5 #-}</span>
<a name="line-564"></a>
<a name="line-565"></a><a name="zipWith6"></a><span class='hs-comment'>-- | Pass input from a stream through two iteratees at once. Excess input is</span>
<a name="line-566"></a><span class='hs-comment'>-- yielded if it was not consumed by either iteratee. Output from the</span>
<a name="line-567"></a><span class='hs-comment'>-- iteratees is combined with a user-provided function.</span>
<a name="line-568"></a><span class='hs-comment'>--</span>
<a name="line-569"></a><span class='hs-comment'>-- Analogous to 'Data.List.zipWith6'.</span>
<a name="line-570"></a><span class='hs-comment'>--</span>
<a name="line-571"></a><span class='hs-comment'>-- Since: 0.4.14</span>
<a name="line-572"></a><span class='hs-definition'>zipWith6</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Monad</span> <span class='hs-varid'>m</span>
<a name="line-573"></a> <span class='hs-keyglyph'>=></span> <span class='hs-layout'>(</span><span class='hs-varid'>b1</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>b2</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>b3</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>b4</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>b5</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>b6</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>c</span><span class='hs-layout'>)</span>
<a name="line-574"></a> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Iteratee</span> <span class='hs-varid'>a</span> <span class='hs-varid'>m</span> <span class='hs-varid'>b1</span>
<a name="line-575"></a> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Iteratee</span> <span class='hs-varid'>a</span> <span class='hs-varid'>m</span> <span class='hs-varid'>b2</span>
<a name="line-576"></a> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Iteratee</span> <span class='hs-varid'>a</span> <span class='hs-varid'>m</span> <span class='hs-varid'>b3</span>
<a name="line-577"></a> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Iteratee</span> <span class='hs-varid'>a</span> <span class='hs-varid'>m</span> <span class='hs-varid'>b4</span>
<a name="line-578"></a> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Iteratee</span> <span class='hs-varid'>a</span> <span class='hs-varid'>m</span> <span class='hs-varid'>b5</span>
<a name="line-579"></a> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Iteratee</span> <span class='hs-varid'>a</span> <span class='hs-varid'>m</span> <span class='hs-varid'>b6</span>
<a name="line-580"></a> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Iteratee</span> <span class='hs-varid'>a</span> <span class='hs-varid'>m</span> <span class='hs-varid'>c</span>
<a name="line-581"></a><span class='hs-definition'>zipWith6</span> <span class='hs-varid'>f</span> <span class='hs-varid'>i1</span> <span class='hs-varid'>i2</span> <span class='hs-varid'>i3</span> <span class='hs-varid'>i4</span> <span class='hs-varid'>i5</span> <span class='hs-varid'>i6</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>do</span>
<a name="line-582"></a> <span class='hs-layout'>(</span><span class='hs-varid'>b1</span><span class='hs-layout'>,</span> <span class='hs-varid'>b2</span><span class='hs-layout'>,</span> <span class='hs-varid'>b3</span><span class='hs-layout'>,</span> <span class='hs-varid'>b4</span><span class='hs-layout'>,</span> <span class='hs-varid'>b5</span><span class='hs-layout'>,</span> <span class='hs-varid'>b6</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>zip6</span> <span class='hs-varid'>i1</span> <span class='hs-varid'>i2</span> <span class='hs-varid'>i3</span> <span class='hs-varid'>i4</span> <span class='hs-varid'>i5</span> <span class='hs-varid'>i6</span>
<a name="line-583"></a> <span class='hs-varid'>return</span> <span class='hs-layout'>(</span><span class='hs-varid'>f</span> <span class='hs-varid'>b1</span> <span class='hs-varid'>b2</span> <span class='hs-varid'>b3</span> <span class='hs-varid'>b4</span> <span class='hs-varid'>b5</span> <span class='hs-varid'>b6</span><span class='hs-layout'>)</span>
<a name="line-584"></a><span class='hs-comment'>{-# INLINE zipWith6 #-}</span>
<a name="line-585"></a>
<a name="line-586"></a><a name="zipWith7"></a><span class='hs-comment'>-- | Pass input from a stream through two iteratees at once. Excess input is</span>
<a name="line-587"></a><span class='hs-comment'>-- yielded if it was not consumed by either iteratee. Output from the</span>
<a name="line-588"></a><span class='hs-comment'>-- iteratees is combined with a user-provided function.</span>
<a name="line-589"></a><span class='hs-comment'>--</span>
<a name="line-590"></a><span class='hs-comment'>-- Analogous to 'Data.List.zipWith7'.</span>
<a name="line-591"></a><span class='hs-comment'>--</span>
<a name="line-592"></a><span class='hs-comment'>-- Since: 0.4.14</span>
<a name="line-593"></a><span class='hs-definition'>zipWith7</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Monad</span> <span class='hs-varid'>m</span>
<a name="line-594"></a> <span class='hs-keyglyph'>=></span> <span class='hs-layout'>(</span><span class='hs-varid'>b1</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>b2</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>b3</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>b4</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>b5</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>b6</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>b7</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>c</span><span class='hs-layout'>)</span>
<a name="line-595"></a> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Iteratee</span> <span class='hs-varid'>a</span> <span class='hs-varid'>m</span> <span class='hs-varid'>b1</span>
<a name="line-596"></a> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Iteratee</span> <span class='hs-varid'>a</span> <span class='hs-varid'>m</span> <span class='hs-varid'>b2</span>
<a name="line-597"></a> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Iteratee</span> <span class='hs-varid'>a</span> <span class='hs-varid'>m</span> <span class='hs-varid'>b3</span>
<a name="line-598"></a> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Iteratee</span> <span class='hs-varid'>a</span> <span class='hs-varid'>m</span> <span class='hs-varid'>b4</span>
<a name="line-599"></a> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Iteratee</span> <span class='hs-varid'>a</span> <span class='hs-varid'>m</span> <span class='hs-varid'>b5</span>
<a name="line-600"></a> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Iteratee</span> <span class='hs-varid'>a</span> <span class='hs-varid'>m</span> <span class='hs-varid'>b6</span>
<a name="line-601"></a> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Iteratee</span> <span class='hs-varid'>a</span> <span class='hs-varid'>m</span> <span class='hs-varid'>b7</span>
<a name="line-602"></a> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Iteratee</span> <span class='hs-varid'>a</span> <span class='hs-varid'>m</span> <span class='hs-varid'>c</span>
<a name="line-603"></a><span class='hs-definition'>zipWith7</span> <span class='hs-varid'>f</span> <span class='hs-varid'>i1</span> <span class='hs-varid'>i2</span> <span class='hs-varid'>i3</span> <span class='hs-varid'>i4</span> <span class='hs-varid'>i5</span> <span class='hs-varid'>i6</span> <span class='hs-varid'>i7</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>do</span>
<a name="line-604"></a> <span class='hs-layout'>(</span><span class='hs-varid'>b1</span><span class='hs-layout'>,</span> <span class='hs-varid'>b2</span><span class='hs-layout'>,</span> <span class='hs-varid'>b3</span><span class='hs-layout'>,</span> <span class='hs-varid'>b4</span><span class='hs-layout'>,</span> <span class='hs-varid'>b5</span><span class='hs-layout'>,</span> <span class='hs-varid'>b6</span><span class='hs-layout'>,</span> <span class='hs-varid'>b7</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>zip7</span> <span class='hs-varid'>i1</span> <span class='hs-varid'>i2</span> <span class='hs-varid'>i3</span> <span class='hs-varid'>i4</span> <span class='hs-varid'>i5</span> <span class='hs-varid'>i6</span> <span class='hs-varid'>i7</span>
<a name="line-605"></a> <span class='hs-varid'>return</span> <span class='hs-layout'>(</span><span class='hs-varid'>f</span> <span class='hs-varid'>b1</span> <span class='hs-varid'>b2</span> <span class='hs-varid'>b3</span> <span class='hs-varid'>b4</span> <span class='hs-varid'>b5</span> <span class='hs-varid'>b6</span> <span class='hs-varid'>b7</span><span class='hs-layout'>)</span>
<a name="line-606"></a><span class='hs-comment'>{-# INLINE zipWith7 #-}</span>
<a name="line-607"></a>
<a name="line-608"></a><a name="head"></a><span class='hs-comment'>-- | Get the next element from the stream, or 'Nothing' if the stream has</span>
<a name="line-609"></a><span class='hs-comment'>-- ended.</span>
<a name="line-610"></a><span class='hs-comment'>--</span>
<a name="line-611"></a><span class='hs-comment'>-- Since: 0.4.5</span>
<a name="line-612"></a><span class='hs-definition'>head</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Monad</span> <span class='hs-varid'>m</span> <span class='hs-keyglyph'>=></span> <span class='hs-conid'>Iteratee</span> <span class='hs-varid'>a</span> <span class='hs-varid'>m</span> <span class='hs-layout'>(</span><span class='hs-conid'>Maybe</span> <span class='hs-varid'>a</span><span class='hs-layout'>)</span>
<a name="line-613"></a><span class='hs-definition'>head</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>continue</span> <span class='hs-varid'>loop</span> <span class='hs-keyword'>where</span>
<a name="line-614"></a> <span class='hs-varid'>loop</span> <span class='hs-layout'>(</span><span class='hs-conid'>Chunks</span> <span class='hs-conid'>[]</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>head</span>
<a name="line-615"></a> <span class='hs-varid'>loop</span> <span class='hs-layout'>(</span><span class='hs-conid'>Chunks</span> <span class='hs-layout'>(</span><span class='hs-varid'>x</span><span class='hs-conop'>:</span><span class='hs-varid'>xs</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>yield</span> <span class='hs-layout'>(</span><span class='hs-conid'>Just</span> <span class='hs-varid'>x</span><span class='hs-layout'>)</span> <span class='hs-layout'>(</span><span class='hs-conid'>Chunks</span> <span class='hs-varid'>xs</span><span class='hs-layout'>)</span>
<a name="line-616"></a> <span class='hs-varid'>loop</span> <span class='hs-conid'>EOF</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>yield</span> <span class='hs-conid'>Nothing</span> <span class='hs-conid'>EOF</span>
<a name="line-617"></a>
<a name="line-618"></a><a name="head_"></a><span class='hs-comment'>-- | Get the next element from the stream, or raise an error if the stream</span>
<a name="line-619"></a><span class='hs-comment'>-- has ended.</span>
<a name="line-620"></a><span class='hs-comment'>--</span>
<a name="line-621"></a><span class='hs-comment'>-- Since: 0.4.14</span>
<a name="line-622"></a><span class='hs-definition'>head_</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Monad</span> <span class='hs-varid'>m</span> <span class='hs-keyglyph'>=></span> <span class='hs-conid'>Iteratee</span> <span class='hs-varid'>a</span> <span class='hs-varid'>m</span> <span class='hs-varid'>a</span>
<a name="line-623"></a><span class='hs-definition'>head_</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>head</span> <span class='hs-varop'>>>=</span> <span class='hs-keyglyph'>\</span><span class='hs-varid'>x</span> <span class='hs-keyglyph'>-></span> <span class='hs-keyword'>case</span> <span class='hs-varid'>x</span> <span class='hs-keyword'>of</span>
<a name="line-624"></a> <span class='hs-conid'>Just</span> <span class='hs-varid'>x'</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>return</span> <span class='hs-varid'>x'</span>
<a name="line-625"></a> <span class='hs-conid'>Nothing</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>throwError</span> <span class='hs-layout'>(</span><span class='hs-conid'>ErrorCall</span> <span class='hs-str'>"head_: stream has ended"</span><span class='hs-layout'>)</span>
<a name="line-626"></a>
<a name="line-627"></a><a name="drop"></a><span class='hs-comment'>-- | @'drop' n@ ignores /n/ input elements from the stream.</span>
<a name="line-628"></a><span class='hs-comment'>--</span>
<a name="line-629"></a><span class='hs-comment'>-- Since: 0.4.5</span>
<a name="line-630"></a><span class='hs-definition'>drop</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Monad</span> <span class='hs-varid'>m</span> <span class='hs-keyglyph'>=></span> <span class='hs-conid'>Integer</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Iteratee</span> <span class='hs-varid'>a</span> <span class='hs-varid'>m</span> <span class='hs-conid'>()</span>
<a name="line-631"></a><span class='hs-definition'>drop</span> <span class='hs-varid'>n</span> <span class='hs-keyglyph'>|</span> <span class='hs-varid'>n</span> <span class='hs-varop'><=</span> <span class='hs-num'>0</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>return</span> <span class='hs-conid'>()</span>
<a name="line-632"></a><span class='hs-definition'>drop</span> <span class='hs-varid'>n</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>continue</span> <span class='hs-layout'>(</span><span class='hs-varid'>loop</span> <span class='hs-varid'>n</span><span class='hs-layout'>)</span> <span class='hs-keyword'>where</span>
<a name="line-633"></a> <span class='hs-varid'>loop</span> <span class='hs-varid'>n'</span> <span class='hs-layout'>(</span><span class='hs-conid'>Chunks</span> <span class='hs-varid'>xs</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>iter</span> <span class='hs-keyword'>where</span>
<a name="line-634"></a> <span class='hs-varid'>len</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>L</span><span class='hs-varop'>.</span><span class='hs-varid'>genericLength</span> <span class='hs-varid'>xs</span>
<a name="line-635"></a> <span class='hs-varid'>iter</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>if</span> <span class='hs-varid'>len</span> <span class='hs-varop'><</span> <span class='hs-varid'>n'</span>
<a name="line-636"></a> <span class='hs-keyword'>then</span> <span class='hs-varid'>drop</span> <span class='hs-layout'>(</span><span class='hs-varid'>n'</span> <span class='hs-comment'>-</span> <span class='hs-varid'>len</span><span class='hs-layout'>)</span>
<a name="line-637"></a> <span class='hs-keyword'>else</span> <span class='hs-varid'>yield</span> <span class='hs-conid'>()</span> <span class='hs-layout'>(</span><span class='hs-conid'>Chunks</span> <span class='hs-layout'>(</span><span class='hs-conid'>L</span><span class='hs-varop'>.</span><span class='hs-varid'>genericDrop</span> <span class='hs-varid'>n'</span> <span class='hs-varid'>xs</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span>
<a name="line-638"></a> <span class='hs-varid'>loop</span> <span class='hs-keyword'>_</span> <span class='hs-conid'>EOF</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>yield</span> <span class='hs-conid'>()</span> <span class='hs-conid'>EOF</span>
<a name="line-639"></a>
<a name="line-640"></a><a name="dropWhile"></a><span class='hs-comment'>-- | @'Data.Enumerator.List.dropWhile' p@ ignores input from the stream</span>
<a name="line-641"></a><span class='hs-comment'>-- until the first element which does not match the predicate.</span>
<a name="line-642"></a><span class='hs-comment'>--</span>
<a name="line-643"></a><span class='hs-comment'>-- Since: 0.4.5</span>
<a name="line-644"></a><span class='hs-definition'>dropWhile</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Monad</span> <span class='hs-varid'>m</span> <span class='hs-keyglyph'>=></span> <span class='hs-layout'>(</span><span class='hs-varid'>a</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Bool</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Iteratee</span> <span class='hs-varid'>a</span> <span class='hs-varid'>m</span> <span class='hs-conid'>()</span>
<a name="line-645"></a><span class='hs-definition'>dropWhile</span> <span class='hs-varid'>p</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>continue</span> <span class='hs-varid'>loop</span> <span class='hs-keyword'>where</span>
<a name="line-646"></a> <span class='hs-varid'>loop</span> <span class='hs-layout'>(</span><span class='hs-conid'>Chunks</span> <span class='hs-varid'>xs</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>case</span> <span class='hs-conid'>L</span><span class='hs-varop'>.</span><span class='hs-varid'>dropWhile</span> <span class='hs-varid'>p</span> <span class='hs-varid'>xs</span> <span class='hs-keyword'>of</span>
<a name="line-647"></a> <span class='hs-conid'>[]</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>continue</span> <span class='hs-varid'>loop</span>
<a name="line-648"></a> <span class='hs-varid'>xs'</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>yield</span> <span class='hs-conid'>()</span> <span class='hs-layout'>(</span><span class='hs-conid'>Chunks</span> <span class='hs-varid'>xs'</span><span class='hs-layout'>)</span>
<a name="line-649"></a> <span class='hs-varid'>loop</span> <span class='hs-conid'>EOF</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>yield</span> <span class='hs-conid'>()</span> <span class='hs-conid'>EOF</span>
<a name="line-650"></a>
<a name="line-651"></a><a name="require"></a><span class='hs-comment'>-- | @'require' n@ buffers input until at least /n/ elements are available, or</span>
<a name="line-652"></a><span class='hs-comment'>-- throws an error if the stream ends early.</span>
<a name="line-653"></a><span class='hs-comment'>--</span>
<a name="line-654"></a><span class='hs-comment'>-- Since: 0.4.5</span>
<a name="line-655"></a><span class='hs-definition'>require</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Monad</span> <span class='hs-varid'>m</span> <span class='hs-keyglyph'>=></span> <span class='hs-conid'>Integer</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Iteratee</span> <span class='hs-varid'>a</span> <span class='hs-varid'>m</span> <span class='hs-conid'>()</span>
<a name="line-656"></a><span class='hs-definition'>require</span> <span class='hs-varid'>n</span> <span class='hs-keyglyph'>|</span> <span class='hs-varid'>n</span> <span class='hs-varop'><=</span> <span class='hs-num'>0</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>return</span> <span class='hs-conid'>()</span>
<a name="line-657"></a><span class='hs-definition'>require</span> <span class='hs-varid'>n</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>continue</span> <span class='hs-layout'>(</span><span class='hs-varid'>loop</span> <span class='hs-varid'>id</span> <span class='hs-varid'>n</span><span class='hs-layout'>)</span> <span class='hs-keyword'>where</span>
<a name="line-658"></a> <span class='hs-varid'>len</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>L</span><span class='hs-varop'>.</span><span class='hs-varid'>genericLength</span>
<a name="line-659"></a> <span class='hs-varid'>loop</span> <span class='hs-varid'>acc</span> <span class='hs-varid'>n'</span> <span class='hs-layout'>(</span><span class='hs-conid'>Chunks</span> <span class='hs-varid'>xs</span><span class='hs-layout'>)</span>
<a name="line-660"></a> <span class='hs-keyglyph'>|</span> <span class='hs-varid'>len</span> <span class='hs-varid'>xs</span> <span class='hs-varop'><</span> <span class='hs-varid'>n'</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>continue</span> <span class='hs-layout'>(</span><span class='hs-varid'>loop</span> <span class='hs-layout'>(</span><span class='hs-varid'>acc</span> <span class='hs-varop'>.</span> <span class='hs-layout'>(</span><span class='hs-varid'>xs</span> <span class='hs-varop'>++</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span> <span class='hs-layout'>(</span><span class='hs-varid'>n'</span> <span class='hs-comment'>-</span> <span class='hs-varid'>len</span> <span class='hs-varid'>xs</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span>
<a name="line-661"></a> <span class='hs-keyglyph'>|</span> <span class='hs-varid'>otherwise</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>yield</span> <span class='hs-conid'>()</span> <span class='hs-layout'>(</span><span class='hs-conid'>Chunks</span> <span class='hs-layout'>(</span><span class='hs-varid'>acc</span> <span class='hs-varid'>xs</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span>
<a name="line-662"></a> <span class='hs-varid'>loop</span> <span class='hs-keyword'>_</span> <span class='hs-keyword'>_</span> <span class='hs-conid'>EOF</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>throwError</span> <span class='hs-layout'>(</span><span class='hs-conid'>ErrorCall</span> <span class='hs-str'>"require: Unexpected EOF"</span><span class='hs-layout'>)</span>
<a name="line-663"></a>
<a name="line-664"></a><a name="isolate"></a><span class='hs-comment'>-- | @'isolate' n@ reads at most /n/ elements from the stream, and passes them</span>
<a name="line-665"></a><span class='hs-comment'>-- to its iteratee. If the iteratee finishes early, elements continue to be</span>
<a name="line-666"></a><span class='hs-comment'>-- consumed from the outer stream until /n/ have been consumed.</span>
<a name="line-667"></a><span class='hs-comment'>--</span>
<a name="line-668"></a><span class='hs-comment'>-- Since: 0.4.5</span>
<a name="line-669"></a><span class='hs-definition'>isolate</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Monad</span> <span class='hs-varid'>m</span> <span class='hs-keyglyph'>=></span> <span class='hs-conid'>Integer</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Enumeratee</span> <span class='hs-varid'>a</span> <span class='hs-varid'>a</span> <span class='hs-varid'>m</span> <span class='hs-varid'>b</span>
<a name="line-670"></a><span class='hs-definition'>isolate</span> <span class='hs-varid'>n</span> <span class='hs-varid'>step</span> <span class='hs-keyglyph'>|</span> <span class='hs-varid'>n</span> <span class='hs-varop'><=</span> <span class='hs-num'>0</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>return</span> <span class='hs-varid'>step</span>
<a name="line-671"></a><span class='hs-definition'>isolate</span> <span class='hs-varid'>n</span> <span class='hs-layout'>(</span><span class='hs-conid'>Continue</span> <span class='hs-varid'>k</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>continue</span> <span class='hs-varid'>loop</span> <span class='hs-keyword'>where</span>
<a name="line-672"></a> <span class='hs-varid'>len</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>L</span><span class='hs-varop'>.</span><span class='hs-varid'>genericLength</span>
<a name="line-673"></a>
<a name="line-674"></a> <span class='hs-varid'>loop</span> <span class='hs-layout'>(</span><span class='hs-conid'>Chunks</span> <span class='hs-conid'>[]</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>continue</span> <span class='hs-varid'>loop</span>
<a name="line-675"></a> <span class='hs-varid'>loop</span> <span class='hs-layout'>(</span><span class='hs-conid'>Chunks</span> <span class='hs-varid'>xs</span><span class='hs-layout'>)</span>
<a name="line-676"></a> <span class='hs-keyglyph'>|</span> <span class='hs-varid'>len</span> <span class='hs-varid'>xs</span> <span class='hs-varop'><=</span> <span class='hs-varid'>n</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>k</span> <span class='hs-layout'>(</span><span class='hs-conid'>Chunks</span> <span class='hs-varid'>xs</span><span class='hs-layout'>)</span> <span class='hs-varop'>>>==</span> <span class='hs-varid'>isolate</span> <span class='hs-layout'>(</span><span class='hs-varid'>n</span> <span class='hs-comment'>-</span> <span class='hs-varid'>len</span> <span class='hs-varid'>xs</span><span class='hs-layout'>)</span>
<a name="line-677"></a> <span class='hs-keyglyph'>|</span> <span class='hs-varid'>otherwise</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>let</span>
<a name="line-678"></a> <span class='hs-layout'>(</span><span class='hs-varid'>s1</span><span class='hs-layout'>,</span> <span class='hs-varid'>s2</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>L</span><span class='hs-varop'>.</span><span class='hs-varid'>genericSplitAt</span> <span class='hs-varid'>n</span> <span class='hs-varid'>xs</span>
<a name="line-679"></a> <span class='hs-keyword'>in</span> <span class='hs-varid'>k</span> <span class='hs-layout'>(</span><span class='hs-conid'>Chunks</span> <span class='hs-varid'>s1</span><span class='hs-layout'>)</span> <span class='hs-varop'>>>==</span> <span class='hs-layout'>(</span><span class='hs-varop'>`yield`</span> <span class='hs-conid'>Chunks</span> <span class='hs-varid'>s2</span><span class='hs-layout'>)</span>
<a name="line-680"></a> <span class='hs-varid'>loop</span> <span class='hs-conid'>EOF</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>k</span> <span class='hs-conid'>EOF</span> <span class='hs-varop'>>>==</span> <span class='hs-layout'>(</span><span class='hs-varop'>`yield`</span> <span class='hs-conid'>EOF</span><span class='hs-layout'>)</span>
<a name="line-681"></a><span class='hs-definition'>isolate</span> <span class='hs-varid'>n</span> <span class='hs-varid'>step</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>drop</span> <span class='hs-varid'>n</span> <span class='hs-varop'>>></span> <span class='hs-varid'>return</span> <span class='hs-varid'>step</span>
<a name="line-682"></a>
<a name="line-683"></a><a name="isolateWhile"></a><span class='hs-comment'>-- | @'isolateWhile' p@ reads elements from the stream until /p/ is false, and</span>
<a name="line-684"></a><span class='hs-comment'>-- passes them to its iteratee. If the iteratee finishes early, elements</span>
<a name="line-685"></a><span class='hs-comment'>-- continue to be consumed from the outer stream until /p/ is false.</span>
<a name="line-686"></a><span class='hs-comment'>--</span>
<a name="line-687"></a><span class='hs-comment'>-- Since: 0.4.16</span>
<a name="line-688"></a><span class='hs-definition'>isolateWhile</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Monad</span> <span class='hs-varid'>m</span> <span class='hs-keyglyph'>=></span> <span class='hs-layout'>(</span><span class='hs-varid'>a</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Bool</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Enumeratee</span> <span class='hs-varid'>a</span> <span class='hs-varid'>a</span> <span class='hs-varid'>m</span> <span class='hs-varid'>b</span>
<a name="line-689"></a><span class='hs-definition'>isolateWhile</span> <span class='hs-varid'>p</span> <span class='hs-layout'>(</span><span class='hs-conid'>Continue</span> <span class='hs-varid'>k</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>continue</span> <span class='hs-varid'>loop</span> <span class='hs-keyword'>where</span>
<a name="line-690"></a> <span class='hs-varid'>loop</span> <span class='hs-layout'>(</span><span class='hs-conid'>Chunks</span> <span class='hs-conid'>[]</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>continue</span> <span class='hs-varid'>loop</span>
<a name="line-691"></a> <span class='hs-varid'>loop</span> <span class='hs-layout'>(</span><span class='hs-conid'>Chunks</span> <span class='hs-varid'>xs</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>case</span> <span class='hs-conid'>Prelude</span><span class='hs-varop'>.</span><span class='hs-varid'>span</span> <span class='hs-varid'>p</span> <span class='hs-varid'>xs</span> <span class='hs-keyword'>of</span>
<a name="line-692"></a> <span class='hs-layout'>(</span><span class='hs-keyword'>_</span><span class='hs-layout'>,</span> <span class='hs-conid'>[]</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>k</span> <span class='hs-layout'>(</span><span class='hs-conid'>Chunks</span> <span class='hs-varid'>xs</span><span class='hs-layout'>)</span> <span class='hs-varop'>>>==</span> <span class='hs-varid'>isolateWhile</span> <span class='hs-varid'>p</span>
<a name="line-693"></a> <span class='hs-layout'>(</span><span class='hs-varid'>s1</span><span class='hs-layout'>,</span> <span class='hs-varid'>s2</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>k</span> <span class='hs-layout'>(</span><span class='hs-conid'>Chunks</span> <span class='hs-varid'>s1</span><span class='hs-layout'>)</span> <span class='hs-varop'>>>==</span> <span class='hs-layout'>(</span><span class='hs-varop'>`yield`</span> <span class='hs-conid'>Chunks</span> <span class='hs-varid'>s2</span><span class='hs-layout'>)</span>
<a name="line-694"></a> <span class='hs-varid'>loop</span> <span class='hs-conid'>EOF</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>k</span> <span class='hs-conid'>EOF</span> <span class='hs-varop'>>>==</span> <span class='hs-layout'>(</span><span class='hs-varop'>`yield`</span> <span class='hs-conid'>EOF</span><span class='hs-layout'>)</span>
<a name="line-695"></a><span class='hs-definition'>isolateWhile</span> <span class='hs-varid'>p</span> <span class='hs-varid'>step</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>Enumerator</span><span class='hs-varop'>.</span><span class='hs-conid'>List</span><span class='hs-varop'>.</span><span class='hs-varid'>dropWhile</span> <span class='hs-varid'>p</span> <span class='hs-varop'>>></span> <span class='hs-varid'>return</span> <span class='hs-varid'>step</span>
<a name="line-696"></a>
<a name="line-697"></a><a name="splitWhen"></a><span class='hs-comment'>-- | Split on elements satisfying a given predicate.</span>
<a name="line-698"></a><span class='hs-comment'>--</span>
<a name="line-699"></a><span class='hs-comment'>-- Since: 0.4.8</span>
<a name="line-700"></a><span class='hs-definition'>splitWhen</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Monad</span> <span class='hs-varid'>m</span> <span class='hs-keyglyph'>=></span> <span class='hs-layout'>(</span><span class='hs-varid'>a</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Bool</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Enumeratee</span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>[</span><span class='hs-varid'>a</span><span class='hs-keyglyph'>]</span> <span class='hs-varid'>m</span> <span class='hs-varid'>b</span>
<a name="line-701"></a><span class='hs-definition'>splitWhen</span> <span class='hs-varid'>p</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>sequence</span> <span class='hs-varop'>$</span> <span class='hs-keyword'>do</span>
<a name="line-702"></a> <span class='hs-keyword'>as</span> <span class='hs-keyglyph'><-</span> <span class='hs-varid'>takeWhile</span> <span class='hs-layout'>(</span><span class='hs-varid'>not</span> <span class='hs-varop'>.</span> <span class='hs-varid'>p</span><span class='hs-layout'>)</span>
<a name="line-703"></a> <span class='hs-varid'>drop</span> <span class='hs-num'>1</span>
<a name="line-704"></a> <span class='hs-varid'>return</span> <span class='hs-keyword'>as</span>
<a name="line-705"></a>
<a name="line-706"></a><a name="unique"></a><span class='hs-comment'>-- | Remove duplicate elements from a stream, passing through the first</span>
<a name="line-707"></a><span class='hs-comment'>-- instance of each value.</span>
<a name="line-708"></a><span class='hs-comment'>--</span>
<a name="line-709"></a><span class='hs-comment'>-- Similar to 'nub', but more efficient because it uses a 'Data.Set.Set'</span>
<a name="line-710"></a><span class='hs-comment'>-- internally.</span>
<a name="line-711"></a><span class='hs-comment'>--</span>
<a name="line-712"></a><span class='hs-comment'>-- Since: 0.4.11</span>
<a name="line-713"></a><span class='hs-definition'>unique</span> <span class='hs-keyglyph'>::</span> <span class='hs-layout'>(</span><span class='hs-conid'>Ord</span> <span class='hs-varid'>a</span><span class='hs-layout'>,</span> <span class='hs-conid'>Monad</span> <span class='hs-varid'>m</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=></span> <span class='hs-conid'>Enumeratee</span> <span class='hs-varid'>a</span> <span class='hs-varid'>a</span> <span class='hs-varid'>m</span> <span class='hs-varid'>b</span>
<a name="line-714"></a><span class='hs-definition'>unique</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>concatMapAccum</span> <span class='hs-varid'>step</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>Set</span><span class='hs-varop'>.</span><span class='hs-varid'>empty</span> <span class='hs-keyword'>where</span>
<a name="line-715"></a> <span class='hs-varid'>step</span> <span class='hs-varid'>s</span> <span class='hs-varid'>x</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>if</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>Set</span><span class='hs-varop'>.</span><span class='hs-varid'>member</span> <span class='hs-varid'>x</span> <span class='hs-varid'>s</span>
<a name="line-716"></a> <span class='hs-keyword'>then</span> <span class='hs-layout'>(</span><span class='hs-varid'>s</span><span class='hs-layout'>,</span> <span class='hs-conid'>[]</span><span class='hs-layout'>)</span>
<a name="line-717"></a> <span class='hs-keyword'>else</span> <span class='hs-layout'>(</span><span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>Set</span><span class='hs-varop'>.</span><span class='hs-varid'>insert</span> <span class='hs-varid'>x</span> <span class='hs-varid'>s</span><span class='hs-layout'>,</span> <span class='hs-keyglyph'>[</span><span class='hs-varid'>x</span><span class='hs-keyglyph'>]</span><span class='hs-layout'>)</span>
</pre></body>
</html>
|