diff --git a/notebooks/IHaskell.ipynb b/notebooks/IHaskell.ipynb index 2818d75f..7ef7edfe 100644 --- a/notebooks/IHaskell.ipynb +++ b/notebooks/IHaskell.ipynb @@ -2,10 +2,7 @@ "cells": [ { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ "![](https://camo.githubusercontent.com/f6540337202bb3b0c2545d90de0791c9196f9510/68747470733a2f2f7261772e6769746875622e636f6d2f67696269616e736b792f494861736b656c6c2f6d61737465722f68746d6c2f6c6f676f2d36347836342e706e67)\n", "\n", @@ -21,11 +18,7 @@ { "cell_type": "code", "execution_count": 1, - "metadata": { - "collapsed": false, - "deletable": true, - "editable": true - }, + "metadata": {}, "outputs": [ { "data": { @@ -54,10 +47,7 @@ }, { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ "As you can see, each input cell get an execution number. The first input cell is labeled `In [1]`. Just like in GHCi, the output of the last executed statement or expression is available via the `it` variable - however, in addition, the output of the $n$th cell is available via the `itN` variable. For example, if we wanted to see what the first cell printed, we can go ahead and output that:" ] @@ -65,11 +55,7 @@ { "cell_type": "code", "execution_count": 2, - "metadata": { - "collapsed": false, - "deletable": true, - "editable": true - }, + "metadata": {}, "outputs": [ { "data": { @@ -87,10 +73,7 @@ }, { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ "In addition to simple code cells such as the ones you see, you can also have other types of cells. All of this inline text, for instance, is written using Markdown cells, which support the majority of Github markdown syntax. This lets you embed images and formatting and arbitrary HTML interspersed with your Haskell code. In addition, you can export these notebooks into HTML or even as presentations using `reveal.js`. \n", "\n", @@ -100,11 +83,7 @@ { "cell_type": "code", "execution_count": 3, - "metadata": { - "collapsed": false, - "deletable": true, - "editable": true - }, + "metadata": {}, "outputs": [ { "data": { @@ -127,10 +106,7 @@ }, { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ "In addition to multi-line expressions, IHaskell supports most things that you could put in a standard Haskell file. For example, we can have function bindings without the `let` that GHCi requires. (As long as you group type signatures and their corresponding declarations together, you can use pattern matching and put signatures on your top-level declarations!)" ] @@ -138,11 +114,7 @@ { "cell_type": "code", "execution_count": 4, - "metadata": { - "collapsed": false, - "deletable": true, - "editable": true - }, + "metadata": {}, "outputs": [ { "data": { @@ -174,10 +146,7 @@ }, { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ "So far we've just looked at pure functions, but nothing is stopping us from doing IO." ] @@ -185,11 +154,7 @@ { "cell_type": "code", "execution_count": 5, - "metadata": { - "collapsed": false, - "deletable": true, - "editable": true - }, + "metadata": {}, "outputs": [ { "data": { @@ -207,10 +172,7 @@ }, { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ "IHaskell supports most GHC extensions via the `:extension` directive (or any shorthand thereof)." ] @@ -218,11 +180,7 @@ { "cell_type": "code", "execution_count": 6, - "metadata": { - "collapsed": false, - "deletable": true, - "editable": true - }, + "metadata": {}, "outputs": [ { "data": { @@ -329,11 +287,7 @@ { "cell_type": "code", "execution_count": 7, - "metadata": { - "collapsed": false, - "deletable": true, - "editable": true - }, + "metadata": {}, "outputs": [], "source": [ "-- And enable extensions.\n", @@ -343,10 +297,7 @@ }, { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ "Data declarations do pretty much what you expect, and work fine on multiple lines. If a declaration turns out to be not quite what you wanted, you can just go back, edit it, and re-evaluate the code cell." ] @@ -354,11 +305,7 @@ { "cell_type": "code", "execution_count": 8, - "metadata": { - "collapsed": false, - "deletable": true, - "editable": true - }, + "metadata": {}, "outputs": [ { "data": { @@ -382,10 +329,7 @@ }, { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ "Although this doesn't hold everywhere, we've tried to keep IHaskell relatively similar to GHCi in terms of naming. So, just like in GHCi, you can inspect types with `:type` (or shorthands):" ] @@ -393,11 +337,7 @@ { "cell_type": "code", "execution_count": 9, - "metadata": { - "collapsed": false, - "deletable": true, - "editable": true - }, + "metadata": {}, "outputs": [ { "data": { @@ -500,10 +440,7 @@ }, { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ "The same goes for the `:info` command. However, unlike GHCi, which simply prints info, the IHaskell notebook brings up a separate pane." ] @@ -511,11 +448,7 @@ { "cell_type": "code", "execution_count": 10, - "metadata": { - "collapsed": false, - "deletable": true, - "editable": true - }, + "metadata": {}, "outputs": [ { "data": {}, @@ -530,10 +463,7 @@ }, { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ "If you're looking at this notebook after it's been exported to HTML, you won't be able to see this interactive pane that pops up after this is evaluated. However, you can disable the interactive pager, and instead just show the output below the cell:" ] @@ -541,11 +471,7 @@ { "cell_type": "code", "execution_count": 11, - "metadata": { - "collapsed": true, - "deletable": true, - "editable": true - }, + "metadata": {}, "outputs": [], "source": [ "-- Only takes effect on later cells, so stick it in its own cell.\n", @@ -555,11 +481,7 @@ { "cell_type": "code", "execution_count": 12, - "metadata": { - "collapsed": false, - "deletable": true, - "editable": true - }, + "metadata": {}, "outputs": [ { "data": {}, @@ -691,10 +613,7 @@ }, { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ "We can now write slightly more complicated scripts." ] @@ -702,11 +621,7 @@ { "cell_type": "code", "execution_count": 13, - "metadata": { - "collapsed": false, - "deletable": true, - "editable": true - }, + "metadata": {}, "outputs": [ { "data": { @@ -734,10 +649,7 @@ }, { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ "This is where the similarities with GHCi end, and the particularly shiny features of IHaskell begin.\n", "\n", @@ -747,11 +659,7 @@ { "cell_type": "code", "execution_count": 14, - "metadata": { - "collapsed": false, - "deletable": true, - "editable": true - }, + "metadata": {}, "outputs": [], "source": [ "data Color = Red | Green | Blue" @@ -759,10 +667,7 @@ }, { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ "If we were playing around with designing GUI applications, for instance, we might want to actually *see* these colors, instead of just seeing the text \"Red\", \"Green\", and \"Blue\" when we are debugging.\n", "\n", @@ -772,11 +677,7 @@ { "cell_type": "code", "execution_count": 15, - "metadata": { - "collapsed": false, - "deletable": true, - "editable": true - }, + "metadata": {}, "outputs": [], "source": [ "import IHaskell.Display\n", @@ -794,10 +695,7 @@ }, { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ "Once we define a custom `display :: a -> IO Display` function, we can simply output a `Color`:" ] @@ -805,11 +703,7 @@ { "cell_type": "code", "execution_count": 16, - "metadata": { - "collapsed": false, - "deletable": true, - "editable": true - }, + "metadata": {}, "outputs": [ { "data": { @@ -1090,10 +984,7 @@ }, { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ "The `DisplayData` type has several constructors which let you display your data as plain text, HTML, images (SVG, PNG, JPG), or even as LaTeX code.\n", "\n", @@ -1104,10 +995,7 @@ }, { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ "The `ihaskell-aeson` package adds a display for [Aeson](http://hackage.haskell.org/package/aeson) JSON `Value` types. These are automatically formatted as JSON, rather than as Haskell values:" ] @@ -1115,16 +1003,12 @@ { "cell_type": "code", "execution_count": 17, - "metadata": { - "collapsed": false, - "deletable": true, - "editable": true - }, + "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "null" + "Null" ] }, "metadata": {}, @@ -1133,7 +1017,7 @@ { "data": { "text/plain": [ - "true" + "Bool True" ] }, "metadata": {}, @@ -1142,10 +1026,7 @@ { "data": { "text/plain": [ - "{\n", - " \"x\": 3,\n", - " \"y\": 2\n", - "}" + "Object (fromList [(\"x\",Number 3.0),(\"y\",Number 2.0)])" ] }, "metadata": {}, @@ -1169,10 +1050,7 @@ }, { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ "The `ihaskell-blaze` package lets you play around with HTML straight from within IHaskell using the [Blaze](http://jaspervdj.be/blaze/tutorial.html) library." ] @@ -1180,11 +1058,7 @@ { "cell_type": "code", "execution_count": 18, - "metadata": { - "collapsed": false, - "deletable": true, - "editable": true - }, + "metadata": {}, "outputs": [ { "data": { @@ -1270,125 +1144,12 @@ ".suggestion-name {\n", "font-weight: bold;\n", "}\n", - "
\n", - "

\n", - " This is an example of BlazeMarkup syntax.\n", - "

\n", - " \n", - " Hello\n", - " \n", - "
\n" + "<interactive>:1:1: error:
Could not find module ‘Text.Blaze.Html4.Strict’
" ], "text/plain": [ - "
\n", - "

\n", - " This is an example of BlazeMarkup syntax.\n", - "

\n", - " \n", - " Hello\n", - " \n", - "
" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/html": [ - "\n", - "\n", - "\n", - "\n", - "\n" - ], - "text/plain": [ - "\n", - "\n", - "\n", - "\n", - "" + ":1:1: error:\n", + " Could not find module ‘Text.Blaze.Html4.Strict’\n", + " Use -v to see a list of the files searched for." ] }, "metadata": {}, @@ -1413,10 +1174,7 @@ }, { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ "The `ihaskell-diagrams` package allows you to experiment with the [diagrams](http://projects.haskell.org/diagrams/) package. It requires the Cairo backend." ] @@ -1424,15 +1182,99 @@ { "cell_type": "code", "execution_count": 19, - "metadata": { - "collapsed": false, - "deletable": true, - "editable": true - }, + "metadata": {}, "outputs": [ { "data": { - "image/png": "iVBORw0KGgoAAAANSUhEUgAAASwAAAEsCAIAAAD2HxkiAAAABmJLR0QA/wD/AP+gvaeTAAAXMElEQVR4nO3dWXAU1R4G8O6ZyZAoIAWoyL5IFShaWqWlZRX6YOkbD76il9LCCTNZCGEJBjFsYQ0QgbCrIISghB0ETCgWA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EoQwkBKEMJAShDCQEoQwkBKEMJAShDCQEoQwkBKEMJAShDCQEoQwkBKEMJAShDCQEoQwkBKEMJAShDCQEoQwkBKEMJAShDCQEoQwkBKEMJAShDCQEoQwkBKEMJAShDCQEoQwkBKEMJAShDCQEoQwkBKEMJAShDCQEoQwkBKEMJAShDCQEoQwkBKEMJAShDCQEo48eMGTN+/HjaYwAEqXPnzv0fXuhGu5+B2XIAAAAASUVORK5CYII=" + "text/html": [ + "<interactive>:1:1: error:
Could not find module ‘Diagrams.Prelude’
" + ], + "text/plain": [ + ":1:1: error:\n", + " Could not find module ‘Diagrams.Prelude’\n", + " Use -v to see a list of the files searched for." + ] }, "metadata": {}, "output_type": "display_data" @@ -1461,10 +1303,7 @@ }, { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ "Just like with Diagrams, `ihaskell-charts` allows you to use the [Chart](https://github.com/timbod7/haskell-chart/wiki) library for plotting from within IHaskell. (You will need to install `cairo` as well, which may be a bit of a hassle.)" ] @@ -1472,15 +1311,99 @@ { "cell_type": "code", "execution_count": 20, - "metadata": { - "collapsed": false, - "deletable": true, - "editable": true - }, + "metadata": {}, "outputs": [ { "data": { - "image/png": "iVBORw0KGgoAAAANSUhEUgAAAcIAAAEsCAIAAADfNCTgAAAABmJLR0QA/wD/AP+gvaeTAAAgAElEQVR4nO3deVxU5f4H8M/AsKOAu7iz5BKCikuoaAjm1bSUgDIlzSVvmnVdytSbYl3tVm645X5xx6Vc+uVyXTA1S3HD1JsLIosrKKgg2zDn98fUhDADA2dmziyf98s/hnOeec53Bvp01ueRCYIAIiKqLhupCyAiMm+MUSIiURijRESiMEaJiERhjBIRicIYNTOyUmxtbevUqdO3b99jx45V6e1hYWE6tl+/fn1MTExMTIzIfnQne56Hh0ffvn1//vlnvW+ogq2b8vdDpkggs6Lxl2hnZ5eYmKj720NDQ3XcXGhoqMa/k6r2ozuNH1Aulx85ckTv29K2dVP+fsgEcW/ULKn++3zy5Mn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OZoUbGvVGi52RlZTVp0qSgoEDqQsSaOXNmTEyM1FVYBcYoEZEoPKgnIhKFMUpEJApjlIhIFMYoEZEojFEiIlEYo0REojBGiYhEYYwSEYnCGCUiEoUxSkQkCmOUiEgUxigRkSiMUSIiURijRESiMEaJiERhjBIRicIYJSIShTFKRCQKY5SISBTGKBGRKIxRIiJRGKNERKIwRomIRGGMEhGJwhglIhKFMUpEJApjlIhIFMYoEZEojFEiIlEYo0REojBGiYhEYYwSEYnCGCUiEoUxSkQkCmOUiEgUxigRkSiMUSIiURijRESiMEaJiERhjBIRicIYJSIShTFKRCQKY5SISBTGKBGRKIxRIiJRGKNERKIwRomIRGGMEhGJwhglIhKFMUpEJApjlIhIFMYoEZEojFEiIlH+HxoqMQB1jhqbAAAAAElFTkSuQmCC" + "text/html": [ + "<interactive>:1:1: error:
Could not find module ‘Graphics.Rendering.Chart’
" + ], + "text/plain": [ + ":1:1: error:\n", + " Could not find module ‘Graphics.Rendering.Chart’\n", + " Use -v to see a list of the files searched for." + ] }, "metadata": {}, "output_type": "display_data" @@ -1514,10 +1437,7 @@ }, { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ "In addition to displaying outputs in a rich format, IHaskell has a bunch of useful features.\n", "\n", @@ -1527,11 +1447,7 @@ { "cell_type": "code", "execution_count": 21, - "metadata": { - "collapsed": false, - "deletable": true, - "editable": true - }, + "metadata": {}, "outputs": [ { "data": { @@ -1668,10 +1584,7 @@ }, { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ "If you're an experienced Haskeller, though, and don't want `hlint` telling you what to do, you can easily turn it off:" ] @@ -1679,11 +1592,7 @@ { "cell_type": "code", "execution_count": 22, - "metadata": { - "collapsed": false, - "deletable": true, - "editable": true - }, + "metadata": {}, "outputs": [], "source": [ "-- If hlint annoys you, though, you can turn it off.\n", @@ -1694,11 +1603,7 @@ { "cell_type": "code", "execution_count": 23, - "metadata": { - "collapsed": false, - "deletable": true, - "editable": true - }, + "metadata": {}, "outputs": [ { "data": { @@ -1717,10 +1622,7 @@ }, { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ "In addition to `hlint` integration, IHaskell also integrates **Hoogle** for documentation searches. IHaskell provides two directives for searching Hoogle. The first of these, `:document` (or shorthands), looks for exact matches." ] @@ -1728,11 +1630,7 @@ { "cell_type": "code", "execution_count": 24, - "metadata": { - "collapsed": false, - "deletable": true, - "editable": true - }, + "metadata": {}, "outputs": [ { "data": {}, @@ -1823,14 +1721,289 @@ ".suggestion-name {\n", "font-weight: bold;\n", "}\n", - "filterM ∷ Monad m ⇒ (a → m Bool) → [a] → m [a](package base, module Control.Monad)
This generalizes the list-based filter function. \n", + "filterM ∷ Applicative m ⇒ (a → m Bool) → [a] → m [a]
This generalizes the list-based filter function.\n", + "
\n", + "
\n", + "filterM ∷ Monad m ⇒ (a → m Bool) → Vector a → m (Vector a)
O(n) Drop elements that do not satisfy the monadic predicate\n", + "
\n", + "
\n", + "filterM ∷ Monad m ⇒ (a → m Bool) → Bundle v a → Bundle m v a
Yield a monadic stream of elements that satisfy the monadic predicate\n", + "
\n", + "
\n", + "filterM ∷ Monad m ⇒ (a → m Bool) → Bundle m v a → Bundle m v a
Drop elements which do not satisfy the monadic predicate\n", + "
\n", + "
\n", + "filterM ∷ Monad m ⇒ (a → m Bool) → Stream m a → Stream m a
Drop elements which do not satisfy the monadic predicate\n", + "
\n", + "
\n", + "filterM ∷ (Monad m, Vector v a) ⇒ (a → m Bool) → v a → m (v a)
O(n) Drop elements that do not satisfy the monadic predicate\n", + "
\n", + "
\n", + "filterM ∷ (Monad m, Prim a) ⇒ (a → m Bool) → Vector a → m (Vector a)
O(n) Drop elements that do not satisfy the monadic predicate\n", + "
\n", + "
\n", + "filterM ∷ (Monad m, Storable a) ⇒ (a → m Bool) → Vector a → m (Vector a)
O(n) Drop elements that do not satisfy the monadic predicate\n", + "
\n", + "
\n", + "filterM ∷ (Monad m, Unbox a) ⇒ (a → m Bool) → Vector a → m (Vector a)
O(n) Drop elements that do not satisfy the monadic predicate\n", + "
\n", + "
\n", + "filterM ∷ Monad m ⇒ (a → m Bool) → ConduitT a a m ()
Keep only values in the stream passing a given monadic predicate.\n", + "
\n", + "
\n", + "
Subject to fusion\n", + "
\n", + "
\n", + "filterM ∷ Applicative m ⇒ a → m Bool → [a] → m [a]
This generalizes the list-based filter function.\n", + "
\n", + "
\n", + "filterM ∷ Monad m ⇒ (a → m Bool) → Pipe a a m r
(filterM predicate) only forwards values that satisfy the\n", + "
\n", + "
monadic predicate\n", + "
\n", + "
\n", + "
\n",
+       "
\n", + "
filterM (pure (pure True)) = cat\n", + "
\n", + "
\n", + "
filterM (liftA2 (liftA2 (&&)) p1 p2) = filterM p1 >-> filterM p2\n", + "
\n", + "
\n", + "
\n", + "
\n", + "filterM ∷ (a → IO Bool) → InputStream a → IO (InputStream a)
Drops chunks from an input stream if they fail to match a given filter\n", + "
\n", + "
predicate. See filter.\n", + "
\n", + "
\n", + "
Items pushed back to the returned stream are propagated back upstream.\n", + "
\n", + "
\n", + "
Example:\n", + "
\n", + "
\n", + "
\n",
+       "
\n", + "
ghci> Streams.fromList [\"the\", \"quick\", \"brown\", \"fox\"] >>=\n", + "
\n", + "
Streams.filterM (return . (/= \"brown\")) >>= Streams.toList\n", + "
\n", + "
[\"the\",\"quick\",\"fox\"]\n", + "
\n", + "
\n", + "
\n", + "
\n", + "filterM ∷ Applicative m ⇒ a → m Bool → [a] → m [a]
This generalizes the list-based filter function.\n", + "
\n", + "
\n", + "filterM ∷ Applicative m ⇒ a → m Bool → [a] → m [a]
This generalizes the list-based filter function.\n", + "
\n", + "
\n", + "filterM ∷ (IsSequence seq, Monad m) ⇒ (Element seq → m Bool) → seq → m seq
The monadic version of filter.\n", + "
\n", + "
\n", + "filterM ∷ (Monad m) ⇒ (a → m Bool) → Stream (Of a) m r → Stream (Of a) m r
Skip elements of a stream that fail a monadic test\n", + "
\n", + "
\n", + "filterM ∷ Applicative m ⇒ a → m Bool → [a] → m [a]
This generalizes the list-based filter function.\n", + "
\n", + "
\n", + "filterM ∷ (Monad m, Vector v a) ⇒ a → m Bool → v a → m v a
O(n) Drop elements that do not satisfy the monadic predicate\n", + "
\n", + "
\n", + "filterM ∷ Monad m ⇒ a → m Bool → Vector a → m Vector a
O(n) Drop elements that do not satisfy the monadic predicate\n", + "
\n", + "
\n", + "filterM ∷ (Monad m, Storable a) ⇒ a → m Bool → Vector a → m Vector a
O(n) Drop elements that do not satisfy the monadic predicate\n", + "
\n", + "
\n", + "filterM ∷ (Monad m, Unbox a) ⇒ a → m Bool → Vector a → m Vector a
O(n) Drop elements that do not satisfy the monadic predicate\n", + "
\n", + "
\n", + "filterM ∷ Applicative m ⇒ a → m Bool → [a] → m [a]
This generalizes the list-based filter function.\n", + "
\n", + "
\n", + "filterM ∷ Monad m ⇒ (a → m Bool) → [a] → m [a]
\n", + "filterM ∷ Applicative m ⇒ a → m Bool → [a] → m [a]
This generalizes the list-based filter function.\n", + "
\n", + "
\n", + "filterM ∷ Applicative m ⇒ a → m Bool → [a] → m [a]
This generalizes the list-based filter function.\n", + "
\n", + "
\n", + "filterM ∷ (Applicative f) ⇒ (a → f Bool) → [a] → f [a]
See mapM.\n", + "
\n", + "
\n", + "filterM ∷ (Monad m, Vector u a, Vector v b) ⇒ ((a, b) → m Bool) → Vector u v (a, b) → m (Vector u v (a, b))
O(n) Drop elements that do not satisfy the monadic predicate\n", + "
\n", + "
\n", + "filterM ∷ (IsStream t, Monad m) ⇒ (a → m Bool) → t m a → t m a
Same as filter but with a monadic predicate.\n", + "
\n", + "
\n", + "filterM ∷ Applicative m ⇒ a → m Bool → [a] → m [a]
This generalizes the list-based filter function.\n", + "
\n", + "
\n", + "filterM ∷ Applicative m ⇒ a → m Bool → [a] → m [a]
This generalizes the list-based filter function.\n", + "
\n", + "
\n", + "filterM ∷ Applicative m ⇒ a → m Bool → [a] → m [a]
This generalizes the list-based filter function.\n", + "
\n", + "
\n", + "filterM ∷ Applicative m ⇒ a → m Bool → [a] → m [a]
This generalizes the list-based filter function.\n", "
\n", "
\n" ], "text/plain": [ + "filterM :: Applicative m => (a -> m Bool) -> [a] -> m [a]\n", + "URL: https://hackage.haskell.org/package/base/docs/Control-Monad.html#v:filterM\n", + "This generalizes the list-based filter function.\n", + "\n", + "filterM :: Monad m => (a -> m Bool) -> Vector a -> m (Vector a)\n", + "URL: https://hackage.haskell.org/package/vector/docs/Data-Vector.html#v:filterM\n", + "O(n) Drop elements that do not satisfy the monadic predicate\n", + "\n", + "filterM :: Monad m => (a -> m Bool) -> Bundle v a -> Bundle m v a\n", + "URL: https://hackage.haskell.org/package/vector/docs/Data-Vector-Fusion-Bundle.html#v:filterM\n", + "Yield a monadic stream of elements that satisfy the monadic predicate\n", + "\n", + "filterM :: Monad m => (a -> m Bool) -> Bundle m v a -> Bundle m v a\n", + "URL: https://hackage.haskell.org/package/vector/docs/Data-Vector-Fusion-Bundle-Monadic.html#v:filterM\n", + "Drop elements which do not satisfy the monadic predicate\n", + "\n", + "filterM :: Monad m => (a -> m Bool) -> Stream m a -> Stream m a\n", + "URL: https://hackage.haskell.org/package/vector/docs/Data-Vector-Fusion-Stream-Monadic.html#v:filterM\n", + "Drop elements which do not satisfy the monadic predicate\n", + "\n", + "filterM :: (Monad m, Vector v a) => (a -> m Bool) -> v a -> m (v a)\n", + "URL: https://hackage.haskell.org/package/vector/docs/Data-Vector-Generic.html#v:filterM\n", + "O(n) Drop elements that do not satisfy the monadic predicate\n", + "\n", + "filterM :: (Monad m, Prim a) => (a -> m Bool) -> Vector a -> m (Vector a)\n", + "URL: https://hackage.haskell.org/package/vector/docs/Data-Vector-Primitive.html#v:filterM\n", + "O(n) Drop elements that do not satisfy the monadic predicate\n", + "\n", + "filterM :: (Monad m, Storable a) => (a -> m Bool) -> Vector a -> m (Vector a)\n", + "URL: https://hackage.haskell.org/package/vector/docs/Data-Vector-Storable.html#v:filterM\n", + "O(n) Drop elements that do not satisfy the monadic predicate\n", + "\n", + "filterM :: (Monad m, Unbox a) => (a -> m Bool) -> Vector a -> m (Vector a)\n", + "URL: https://hackage.haskell.org/package/vector/docs/Data-Vector-Unboxed.html#v:filterM\n", + "O(n) Drop elements that do not satisfy the monadic predicate\n", + "\n", + "filterM :: Monad m => (a -> m Bool) -> ConduitT a a m ()\n", + "URL: https://hackage.haskell.org/package/conduit/docs/Data-Conduit-Combinators.html#v:filterM\n", + "Keep only values in the stream passing a given monadic predicate.\n", + "\n", + "Subject to fusion\n", + "\n", + "filterM :: Applicative m => a -> m Bool -> [a] -> m [a]\n", + "URL: https://hackage.haskell.org/package/Cabal/docs/Distribution-Compat-Prelude-Internal.html#v:filterM\n", + "This generalizes the list-based filter function.\n", + "\n", + "filterM :: Monad m => (a -> m Bool) -> Pipe a a m r\n", + "URL: https://hackage.haskell.org/package/pipes/docs/Pipes-Prelude.html#v:filterM\n", + "(filterM predicate) only forwards values that satisfy the\n", + "monadic predicate\n", + "\n", + "
\n",
+       "filterM (pure (pure True)) = cat\n",
+       "\n",
+       "filterM (liftA2 (liftA2 (&&)) p1 p2) = filterM p1 >-> filterM p2\n",
+       "
\n", + "\n", + "filterM :: (a -> IO Bool) -> InputStream a -> IO (InputStream a)\n", + "URL: https://hackage.haskell.org/package/io-streams/docs/System-IO-Streams-Combinators.html#v:filterM\n", + "Drops chunks from an input stream if they fail to match a given filter\n", + "predicate. See filter.\n", + "\n", + "Items pushed back to the returned stream are propagated back upstream.\n", + "\n", + "Example:\n", + "\n", + "
\n",
+       "ghci> Streams.fromList [\"the\", \"quick\", \"brown\", \"fox\"] >>=\n",
+       "Streams.filterM (return . (/= \"brown\")) >>= Streams.toList\n",
+       "[\"the\",\"quick\",\"fox\"]\n",
+       "
\n", + "\n", + "filterM :: Applicative m => a -> m Bool -> [a] -> m [a]\n", + "URL: https://hackage.haskell.org/package/protolude/docs/Protolude.html#v:filterM\n", + "This generalizes the list-based filter function.\n", + "\n", + "filterM :: Applicative m => a -> m Bool -> [a] -> m [a]\n", + "URL: https://hackage.haskell.org/package/protolude/docs/Protolude-Monad.html#v:filterM\n", + "This generalizes the list-based filter function.\n", + "\n", + "filterM :: (IsSequence seq, Monad m) => (Element seq -> m Bool) -> seq -> m seq\n", + "URL: https://hackage.haskell.org/package/mono-traversable/docs/Data-Sequences.html#v:filterM\n", + "The monadic version of filter.\n", + "\n", + "filterM :: (Monad m) => (a -> m Bool) -> Stream (Of a) m r -> Stream (Of a) m r\n", + "URL: https://hackage.haskell.org/package/streaming/docs/Streaming-Prelude.html#v:filterM\n", + "Skip elements of a stream that fail a monadic test\n", + "\n", + "filterM :: Applicative m => a -> m Bool -> [a] -> m [a]\n", + "URL: https://hackage.haskell.org/package/rio/docs/RIO.html#v:filterM\n", + "This generalizes the list-based filter function.\n", + "\n", + "filterM :: (Monad m, Vector v a) => a -> m Bool -> v a -> m v a\n", + "URL: https://hackage.haskell.org/package/rio/docs/RIO-Vector.html#v:filterM\n", + "O(n) Drop elements that do not satisfy the monadic predicate\n", + "\n", + "filterM :: Monad m => a -> m Bool -> Vector a -> m Vector a\n", + "URL: https://hackage.haskell.org/package/rio/docs/RIO-Vector-Boxed.html#v:filterM\n", + "O(n) Drop elements that do not satisfy the monadic predicate\n", + "\n", + "filterM :: (Monad m, Storable a) => a -> m Bool -> Vector a -> m Vector a\n", + "URL: https://hackage.haskell.org/package/rio/docs/RIO-Vector-Storable.html#v:filterM\n", + "O(n) Drop elements that do not satisfy the monadic predicate\n", + "\n", + "filterM :: (Monad m, Unbox a) => a -> m Bool -> Vector a -> m Vector a\n", + "URL: https://hackage.haskell.org/package/rio/docs/RIO-Vector-Unboxed.html#v:filterM\n", + "O(n) Drop elements that do not satisfy the monadic predicate\n", + "\n", + "filterM :: Applicative m => a -> m Bool -> [a] -> m [a]\n", + "URL: https://hackage.haskell.org/package/rebase/docs/Rebase-Prelude.html#v:filterM\n", + "This generalizes the list-based filter function.\n", + "\n", "filterM :: Monad m => (a -> m Bool) -> [a] -> m [a]\n", - "URL: http://hackage.haskell.org/packages/archive/base/latest/doc/html/Control-Monad.html#v:filterM\n", - "This generalizes the list-based filter function." + "URL: https://hackage.haskell.org/package/yjtools/docs/Control-Monad-Tools.html#v:filterM\n", + "\n", + "filterM :: Applicative m => a -> m Bool -> [a] -> m [a]\n", + "URL: https://hackage.haskell.org/package/llvm-hs-pure/docs/LLVM-Prelude.html#v:filterM\n", + "This generalizes the list-based filter function.\n", + "\n", + "filterM :: Applicative m => a -> m Bool -> [a] -> m [a]\n", + "URL: https://hackage.haskell.org/package/universum/docs/Universum-Monad-Reexport.html#v:filterM\n", + "This generalizes the list-based filter function.\n", + "\n", + "filterM :: (Applicative f) => (a -> f Bool) -> [a] -> f [a]\n", + "URL: https://hackage.haskell.org/package/haxl/docs/Haxl-Prelude.html#v:filterM\n", + "See mapM.\n", + "\n", + "filterM :: (Monad m, Vector u a, Vector v b) => ((a, b) -> m Bool) -> Vector u v (a, b) -> m (Vector u v (a, b))\n", + "URL: https://hackage.haskell.org/package/hybrid-vectors/docs/Data-Vector-Hybrid.html#v:filterM\n", + "O(n) Drop elements that do not satisfy the monadic predicate\n", + "\n", + "filterM :: (IsStream t, Monad m) => (a -> m Bool) -> t m a -> t m a\n", + "URL: https://hackage.haskell.org/package/streamly/docs/Streamly-Prelude.html#v:filterM\n", + "Same as filter but with a monadic predicate.\n", + "\n", + "filterM :: Applicative m => a -> m Bool -> [a] -> m [a]\n", + "URL: https://hackage.haskell.org/package/yesod-paginator/docs/Yesod-Paginator-Prelude.html#v:filterM\n", + "This generalizes the list-based filter function.\n", + "\n", + "filterM :: Applicative m => a -> m Bool -> [a] -> m [a]\n", + "URL: https://hackage.haskell.org/package/control-monad-free/docs/Control-Monad-Free.html#v:filterM\n", + "This generalizes the list-based filter function.\n", + "\n", + "filterM :: Applicative m => a -> m Bool -> [a] -> m [a]\n", + "URL: https://hackage.haskell.org/package/hledger-web/docs/Hledger-Web-Import.html#v:filterM\n", + "This generalizes the list-based filter function.\n", + "\n", + "filterM :: Applicative m => a -> m Bool -> [a] -> m [a]\n", + "URL: https://hackage.haskell.org/package/relude/docs/Relude-Monad-Reexport.html#v:filterM\n", + "This generalizes the list-based filter function." ] }, "metadata": {}, @@ -1843,10 +2016,7 @@ }, { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ "The other provided command is `:hoogle`. This does a normal Hoogle search, and thus lets you use imperfect matching and searching by type signature. This will show you documentation for things that match the desired type signature, as demonstrated below. It automatically formats inline Haskell code and hyperlinks the identifiers to their respective Haddock documentations." ] @@ -1854,11 +2024,7 @@ { "cell_type": "code", "execution_count": 25, - "metadata": { - "collapsed": false, - "deletable": true, - "editable": true - }, + "metadata": {}, "outputs": [ { "data": {}, @@ -1949,281 +2115,1187 @@ ".suggestion-name {\n", "font-weight: bold;\n", "}\n", - "zip ∷ [a] → [b] → [(a, b)](package base, module Prelude)
zip takes two lists and returns a list of corresponding pairs. If one input list is short, excess elements of the longer list are discarded. \n", + "zip ∷ [a] → [b] → [(a, b)]
zip takes two lists and returns a list of corresponding pairs.\n", + "\n", + "
\n",
+       "zip [1, 2] ['a', 'b'] = [(1, 'a'), (2, 'b')]\n",
+       "
\n", + "\n", + "If one input list is short, excess elements of the longer list are\n", + "discarded:\n", + "\n", + "
\n",
+       "zip [1] ['a', 'b'] = [(1, 'a')]\n",
+       "zip [1, 2] ['a'] = [(1, 'a')]\n",
+       "
\n", + "\n", + "zip is right-lazy:\n", + "\n", + "
\n",
+       "zip [] _|_ = []\n",
+       "zip _|_ [] = _|_\n",
+       "
\n", "
\n", + "zip ∷ [a] → [b] → [(a, b)]
zip takes two lists and returns a list of corresponding pairs.\n", + "\n", + "
\n",
+       "zip [1, 2] ['a', 'b'] = [(1, 'a'), (2, 'b')]\n",
+       "
\n", + "\n", + "If one input list is short, excess elements of the longer list are\n", + "discarded:\n", + "\n", + "
\n",
+       "zip [1] ['a', 'b'] = [(1, 'a')]\n",
+       "zip [1, 2] ['a'] = [(1, 'a')]\n",
+       "
\n", + "\n", + "zip is right-lazy:\n", + "\n", + "
\n",
+       "zip [] _|_ = []\n",
+       "zip _|_ [] = _|_\n",
+       "
\n", "
\n", - "(>*<) ∷ Monoidal f ⇒ f a → f b → f (a, b)(package bytestring, module Data.ByteString.Builder.Prim)
A pairing/concatenation operator for builder primitives, both bounded and fixed size.\n", + "zip ∷ [a] → [b] → [(a, b)]
zip takes two lists and returns a list of corresponding pairs.\n", + "\n", + "
\n",
+       "zip [1, 2] ['a', 'b'] = [(1, 'a'), (2, 'b')]\n",
+       "
\n", + "\n", + "If one input list is short, excess elements of the longer list are\n", + "discarded:\n", + "\n", + "
\n",
+       "zip [1] ['a', 'b'] = [(1, 'a')]\n",
+       "zip [1, 2] ['a'] = [(1, 'a')]\n",
+       "
\n", + "\n", + "zip is right-lazy:\n", + "\n", + "
\n",
+       "zip [] _|_ = []\n",
+       "zip _|_ [] = _|_\n",
+       "
\n", "
\n", - "
\n", - "
For example,\n", + "zip ∷ [a] → [b] → [(a, b)]
zip takes two lists and returns a list of corresponding pairs.\n", + "\n", + "
\n",
+       "zip [1, 2] ['a', 'b'] = [(1, 'a'), (2, 'b')]\n",
+       "
\n", + "\n", + "If one input list is short, excess elements of the longer list are\n", + "discarded:\n", + "\n", + "
\n",
+       "zip [1] ['a', 'b'] = [(1, 'a')]\n",
+       "zip [1, 2] ['a'] = [(1, 'a')]\n",
+       "
\n", + "\n", + "zip is right-lazy:\n", + "\n", + "
\n",
+       "zip [] _|_ = []\n",
+       "zip _|_ [] = _|_\n",
+       "
\n", "
\n", - "
\n", - "
> toLazyByteString (primFixed (char7 >*< char7) ('x','y')) = \"xy\"\n", + "zip ∷ () ⇒ [a] → [b] → [(a, b)]
zip takes two lists and returns a list of corresponding pairs.\n", + "If one input list is short, excess elements of the longer list are\n", + "discarded.\n", + "\n", + "zip is right-lazy:\n", + "\n", + "
\n",
+       "zip [] _|_ = []\n",
+       "
\n", "
\n", - "
\n", - "
We can combine multiple primitives using >*< multiple times.\n", + "zip ∷ () ⇒ [a] → [b] → [(a, b)]
zip takes two lists and returns a list of corresponding pairs.\n", + "If one input list is short, excess elements of the longer list are\n", + "discarded.\n", + "\n", + "zip is right-lazy:\n", + "\n", + "
\n",
+       "zip [] _|_ = []\n",
+       "
\n", "
\n", - "
\n", - "
> toLazyByteString (primFixed (char7 >*< char7 >*< char7) ('x',('y','z'))) = \"xyz\" \n", + "zipExact ∷ Partial ⇒ [a] → [b] → [(a, b)]
\n",
+       "zipExact xs ys =\n",
+       "| length xs == length ys = zip xs ys\n",
+       "| otherwise              = error \"some message\"\n",
+       "
\n", "
\n", + "zip ∷ () ⇒ [a] → [b] → [(a, b)]
zip takes two lists and returns a list of corresponding pairs.\n", + "If one input list is short, excess elements of the longer list are\n", + "discarded.\n", + "\n", + "zip is right-lazy:\n", + "\n", + "
\n",
+       "zip [] _|_ = []\n",
+       "
\n", "
\n", - "shrinkState ∷ ShrinkState s a ⇒ a → s → [(a, s)](package QuickCheck, module Test.QuickCheck.Modifiers)
\n", - "breakOnAll ∷ Text → Text → [(Text, Text)](package text, module Data.Text)
O(n+m) Find all non-overlapping instances of needle in haystack. Each element of the returned list consists of a pair:\n", + "zip ∷ () ⇒ [a] → [b] → [(a, b)]
zip takes two lists and returns a list of corresponding pairs.\n", + "If one input list is short, excess elements of the longer list are\n", + "discarded.\n", + "\n", + "zip is right-lazy:\n", + "\n", + "
\n",
+       "zip [] _|_ = []\n",
+       "
\n", "
\n", - "
\n", - "
* The entire string prior to the kth match (i.e. the prefix)\n", + "zip ∷ () ⇒ [a] → [b] → [(a, b)]
zip takes two lists and returns a list of corresponding pairs.\n", + "If one input list is short, excess elements of the longer list are\n", + "discarded.\n", + "\n", + "zip is right-lazy:\n", + "\n", + "
\n",
+       "zip [] _|_ = []\n",
+       "
\n", "
\n", - "
* The kth match, followed by the remainder of the string\n", + "zip ∷ () ⇒ [a] → [b] → [(a, b)]
zip takes two lists and returns a list of corresponding pairs.\n", + "If one input list is short, excess elements of the longer list are\n", + "discarded.\n", + "\n", + "zip is right-lazy:\n", + "\n", + "
\n",
+       "zip [] _|_ = []\n",
+       "
\n", "
\n", - "
\n", - "
Examples:\n", + "zip ∷ () ⇒ [a] → [b] → [(a, b)]
zip takes two lists and returns a list of corresponding pairs.\n", + "If one input list is short, excess elements of the longer list are\n", + "discarded.\n", + "\n", + "zip is right-lazy:\n", + "\n", + "
\n",
+       "zip [] _|_ = []\n",
+       "
\n", "
\n", - "
\n", - "
> breakOnAll \"::\" \"\"\n", - "> ==> []\n", - "> breakOnAll \"/\" \"a/b/c/\"\n", - "> ==> [(\"a\", \"/b/c/\"), (\"a/b\", \"/c/\"), (\"a/b/c\", \"/\")]\n", + "zip ∷ () ⇒ [a] → [b] → [(a, b)]
zip takes two lists and returns a list of corresponding pairs.\n", + "If one input list is short, excess elements of the longer list are\n", + "discarded.\n", + "\n", + "zip is right-lazy:\n", + "\n", + "
\n",
+       "zip [] _|_ = []\n",
+       "
\n", "
\n", - "
\n", - "
In (unlikely) bad cases, this function's time complexity degrades towards O(n*m).\n", + "zip ∷ () ⇒ [a] → [b] → [(a, b)]
zip takes two lists and returns a list of corresponding pairs.\n", + "If one input list is short, excess elements of the longer list are\n", + "discarded.\n", + "\n", + "zip is right-lazy:\n", + "\n", + "
\n",
+       "zip [] _|_ = []\n",
+       "
\n", "
\n", - "
\n", - "
The needle parameter may not be empty. \n", + "zip ∷ [a] → [b] → [(a, b)]
\n", + "(+*+) ∷ [a] → [b] → [(a, b)]
Slightly unfair 2-way Cartesian product: given two (possibly infinite)\n", + "lists, produce a single list such that whenever v and\n", + "w have finite indices in the input lists, (v,w) has\n", + "finite index in the output list. Lower indices occur as the\n", + "fst part of the tuple more frequently, but not exponentially\n", + "so.\n", "
\n", + "unfairCartesianProduct ∷ [a] → [b] → [(a, b)]
Very unfair 2-way Cartesian product: same guarantee as the slightly\n", + "unfair one, except that lower indices may occur as the fst\n", + "part of the tuple exponentially more frequently. This mainly exists as\n", + "a specification to test against.\n", "
\n", - "breakOnAll ∷ Text → Text → [(Text, Text)](package text, module Data.Text.Lazy)
O(n+m) Find all non-overlapping instances of needle in haystack. Each element of the returned list consists of a pair:\n", + "zip ∷ () ⇒ [a] → [b] → [(a, b)]
zip takes two lists and returns a list of corresponding pairs.\n", + "If one input list is short, excess elements of the longer list are\n", + "discarded.\n", + "\n", + "zip is right-lazy:\n", + "\n", + "
\n",
+       "zip [] _|_ = []\n",
+       "
\n", "
\n", - "
\n", - "
* The entire string prior to the kth match (i.e. the prefix)\n", + "zip ∷ () ⇒ [a] → [b] → [(a, b)]
zip takes two lists and returns a list of corresponding pairs.\n", + "If one input list is short, excess elements of the longer list are\n", + "discarded.\n", + "\n", + "zip is right-lazy:\n", + "\n", + "
\n",
+       "zip [] _|_ = []\n",
+       "
\n", "
\n", - "
* The kth match, followed by the remainder of the string\n", + "zip ∷ () ⇒ [a] → [b] → [(a, b)]
zip takes two lists and returns a list of corresponding pairs.\n", + "If one input list is short, excess elements of the longer list are\n", + "discarded.\n", + "\n", + "zip is right-lazy:\n", + "\n", + "
\n",
+       "zip [] _|_ = []\n",
+       "
\n", "
\n", - "
\n", - "
Examples:\n", + "zip ∷ [a] → [b] → [(a, b)]
\n", + "zip ∷ [a] → [b] → [(a, b)]
\n", + "zip ∷ [a] → [b] → [(a, b)]
\n", + "zip ∷ () ⇒ [a] → [b] → [(a, b)]
zip takes two lists and returns a list of corresponding pairs.\n", + "If one input list is short, excess elements of the longer list are\n", + "discarded.\n", + "\n", + "zip is right-lazy:\n", + "\n", + "
\n",
+       "zip [] _|_ = []\n",
+       "
\n", "
\n", - "
\n", - "
> breakOnAll \"::\" \"\"\n", - "> ==> []\n", - "> breakOnAll \"/\" \"a/b/c/\"\n", - "> ==> [(\"a\", \"/b/c/\"), (\"a/b\", \"/c/\"), (\"a/b/c\", \"/\")]\n", + "zip ∷ () ⇒ [a] → [b] → [(a, b)]
zip takes two lists and returns a list of corresponding pairs.\n", + "If one input list is short, excess elements of the longer list are\n", + "discarded.\n", + "\n", + "zip is right-lazy:\n", + "\n", + "
\n",
+       "zip [] _|_ = []\n",
+       "
\n", "
\n", - "
\n", - "
This function is strict in its first argument, and lazy in its second.\n", + "zip ∷ () ⇒ [a] → [b] → [(a, b)]
zip takes two lists and returns a list of corresponding pairs.\n", + "If one input list is short, excess elements of the longer list are\n", + "discarded.\n", + "\n", + "zip is right-lazy:\n", + "\n", + "
\n",
+       "zip [] _|_ = []\n",
+       "
\n", "
\n", - "
\n", - "
In (unlikely) bad cases, this function's time complexity degrades towards O(n*m).\n", + "zip ∷ () ⇒ [a] → [b] → [(a, b)]
zip takes two lists and returns a list of corresponding pairs.\n", + "If one input list is short, excess elements of the longer list are\n", + "discarded.\n", + "\n", + "zip is right-lazy:\n", + "\n", + "
\n",
+       "zip [] _|_ = []\n",
+       "
\n", "
\n", - "
\n", - "
The needle parameter may not be empty. \n", + "zip ∷ () ⇒ [a] → [b] → [(a, b)]
zip takes two lists and returns a list of corresponding pairs.\n", + "If one input list is short, excess elements of the longer list are\n", + "discarded.\n", + "\n", + "zip is right-lazy:\n", + "\n", + "
\n",
+       "zip [] _|_ = []\n",
+       "
\n", "
\n", + "zip ∷ () ⇒ [a] → [b] → [(a, b)]
zip takes two lists and returns a list of corresponding pairs.\n", + "If one input list is short, excess elements of the longer list are\n", + "discarded.\n", + "\n", + "zip is right-lazy:\n", + "\n", + "
\n",
+       "zip [] _|_ = []\n",
+       "
\n", "
\n", - "genLNodes ∷ Enum a ⇒ a → Int → [LNode a](package fgl, module Data.Graph.Inductive.Example)
generate list of labeled nodes \n", + "zipLazy ∷ [a] → [b] → [(a, b)]
zipLazy is a kind of zip that is lazy in the second list\n", + "(observe the ~)\n", "
\n", + "concurrently ∷ MonadBaseControl IO m ⇒ m a → m b → m (a, b)
Generalized version of concurrently.\n", "
\n", - "gmapAccumT ∷ Data d ⇒ (∀ e. Data e ⇒ a → e → (a, e)) → a → d → (a, d)(package syb, module Data.Generics.Twins)
gmapT with accumulation \n", + "concurrently ∷ ∀ m a b . (MonadBaseControl IO m, Forall (Pure m)) ⇒ m a → m b → m (a, b)
Generalized version of concurrently.\n", "
\n", + "pairADefault ∷ Applicative f ⇒ f a → f b → f (a, b)
Default '>*< implementation for non-invertible\n", + "Applicatives.\n", "
\n", - "threadList ∷ (Collect r c) → (Split t i r) → [i] → t → (c, t)(package fgl, module Data.Graph.Inductive.Internal.Thread)
\n", - "threadList' ∷ (Collect r c) → (Split t i r) → [i] → t → (c, t)(package fgl, module Data.Graph.Inductive.Internal.Thread)
\n", - "mapAccumL ∷ (acc → Word8 → (acc, Word8)) → acc → ByteString → (acc, ByteString)(package bytestring, module Data.ByteString.Lazy)
The mapAccumL function behaves like a combination of map and foldl; it applies a function to each element of a ByteString, passing an accumulating parameter from left to right, and returning a final value of this accumulator together with the new ByteString. \n", + "zip ∷ (Vector v a, Vector v b, Vector v (a, b)) ⇒ v a → v b → v (a, b)
O(min(m,n)) Zip two vectors\n", "
\n", + "pair ∷ (Vector v a, Vector v b, Vector v (a, b)) ⇒ v a → v b → v (a, b)
Pair two samples. It's like zip but requires that both samples\n", + "have equal size.\n", "
\n", - "mapAccumL ∷ (acc → Word8 → (acc, Word8)) → acc → ByteString → (acc, ByteString)(package bytestring, module Data.ByteString)
The mapAccumL function behaves like a combination of map and foldl; it applies a function to each element of a ByteString, passing an accumulating parameter from left to right, and returning a final value of this accumulator together with the new list. \n", + "zip ∷ (Vector v a, Vector v b, Vector v (a, b)) ⇒ v a → v b → v (a, b)
O(min(m,n)) Zip two vectors\n", "
\n", + "concurrently ∷ MonadUnliftIO m ⇒ m a → m b → m (a, b)
Unlifted concurrently.\n", "
\n", - "mapAccumR ∷ (acc → Word8 → (acc, Word8)) → acc → ByteString → (acc, ByteString)(package bytestring, module Data.ByteString)
The mapAccumR function behaves like a combination of map and foldr; it applies a function to each element of a ByteString, passing an accumulating parameter from right to left, and returning a final value of this accumulator together with the new ByteString. \n", + "concurrently ∷ MonadUnliftIO m ⇒ m a → m b → m (a, b)
Unlifted concurrently.\n", "
\n", + "zip ∷ Sequence s ⇒ s a → s b → s (a, b)
Combine two sequences into a sequence of pairs. If the sequences are\n", + "different lengths, the excess elements of the longer sequence is\n", + "discarded.\n", + "\n", + "
\n",
+       "zip <x0,...,xn-1> <y0,...,ym-1> = <(x0,y0),...,(xj-1,yj-1)>\n",
+       "where j = min {n,m}\n",
+       "
\n", + "\n", + "Axioms:\n", + "\n", + "
    \n", + "
  • zip xs ys = zipWith (,) xs ys
  • \n", + "
\n", + "\n", + "This function is always unambiguous.\n", + "\n", + "Default running time: O( min( n1, n2 ) )\n", "
\n", - "mapAccumL ∷ (acc → Char → (acc, Char)) → acc → ByteString → (acc, ByteString)(package bytestring, module Data.ByteString.Lazy.Char8)
The mapAccumL function behaves like a combination of map and foldl; it applies a function to each element of a ByteString, passing an accumulating parameter from left to right, and returning a final value of this accumulator together with the new ByteString. \n", + "zipUsingLview ∷ Sequence s ⇒ s a → s b → s (a, b)
\n", + "zipUsingLists ∷ Sequence s ⇒ s a → s b → s (a, b)
\n", + "concurrently ∷ MonadConc m ⇒ m a → m b → m (a, b)
Run two MonadConc actions concurrently, and return both\n", + "results. If either action throws an exception at any time, then the\n", + "other action is cancelled, and the exception is re-thrown by\n", + "concurrently.\n", + "\n", + "
\n",
+       "concurrently left right =\n",
+       "withAsync left $ \\a ->\n",
+       "withAsync right $ \\b ->\n",
+       "waitBoth a b\n",
+       "
\n", "
\n", + "mzipRep ∷ Representable f ⇒ f a → f b → f (a, b)
\n", + "box ∷ Graph g ⇒ g a → g b → g (a, b)
Compute the Cartesian product of graphs. Complexity: O(s1 *\n", + "s2) time, memory and size, where s1 and s2 are the\n", + "sizes of the given graphs.\n", + "\n", + "
\n",
+       "box (path [0,1]) (path \"ab\") == edges [ ((0,'a'), (0,'b'))\n",
+       ", ((0,'a'), (1,'a'))\n",
+       ", ((0,'b'), (1,'b'))\n",
+       ", ((1,'a'), (1,'b')) ]\n",
+       "
\n", + "\n", + "Up to an isomorphism between the resulting vertex types, this\n", + "operation is commutative, associative,\n", + "distributes over overlay, has singleton graphs as\n", + "identities and empty as the annihilating zero.\n", + "Below ~~ stands for the equality up to an isomorphism, e.g.\n", + "(x, ()) ~~ x.\n", + "\n", + "
\n",
+       "box x y               ~~ box y x\n",
+       "box x (box y z)       ~~ box (box x y) z\n",
+       "box x (overlay y z)   == overlay (box x y) (box x z)\n",
+       "box x (vertex ())     ~~ x\n",
+       "box x empty           ~~ empty\n",
+       "vertexCount (box x y) == vertexCount x * vertexCount y\n",
+       "edgeCount   (box x y) <= vertexCount x * edgeCount y + edgeCount x * vertexCount y\n",
+       "
\n", "
\n", - "mapAccumL ∷ (acc → Char → (acc, Char)) → acc → ByteString → (acc, ByteString)(package bytestring, module Data.ByteString.Char8)
The mapAccumL function behaves like a combination of map and foldl; it applies a function to each element of a ByteString, passing an accumulating parameter from left to right, and returning a final value of this accumulator together with the new list. \n", + "divided ∷ Divisible f ⇒ f a → f b → f (a, b)
\n",
+       "divided = divide id\n",
+       "
\n", "
\n", + "(>*<) ∷ Divisible f ⇒ f a → f b → f (a, b)
The RecordInputType divisible (contravariant) functor allows\n", + "you to build an InputType injector for a Dhall record.\n", + "\n", + "For example, let's take the following Haskell data type:\n", + "\n", + "
\n",
+       "data Project = Project\n",
+       "{ projectName :: Text\n",
+       ", projectDescription :: Text\n",
+       ", projectStars :: Natural\n",
+       "}\n",
+       "
\n", + "\n", + "And assume that we have the following Dhall record that we would like\n", + "to parse as a Project:\n", + "\n", + "
\n",
+       "{ name =\n",
+       "\"dhall-haskell\"\n",
+       ", description =\n",
+       "\"A configuration language guaranteed to terminate\"\n",
+       ", stars =\n",
+       "289\n",
+       "}\n",
+       "
\n", + "\n", + "Our injector has type InputType Project, but we can't\n", + "build that out of any smaller injectors, as InputTypes cannot\n", + "be combined (they are only Contravariants). However, we can use\n", + "an InputRecordType to build an InputType for\n", + "Project:\n", + "\n", + "
\n",
+       "injectProject :: InputType Project\n",
+       "injectProject =\n",
+       "inputRecord\n",
+       "(  adapt >$< inputFieldWith \"name\" inject\n",
+       ">*< inputFieldWith \"description\" inject\n",
+       ">*< inputFieldWith \"stars\" inject\n",
+       ")\n",
+       "where\n",
+       "adapt (Project{..}) = (projectName, (projectDescription, projectStars))\n",
+       "
\n", + "\n", + "Or, since we are simply using the Inject instance to inject\n", + "each field, we could write\n", + "\n", + "
\n",
+       "injectProject :: InputType Project\n",
+       "injectProject =\n",
+       "inputRecord\n",
+       "(  adapt >$< inputField \"name\"\n",
+       ">*< inputField \"description\"\n",
+       ">*< inputField \"stars\"\n",
+       ")\n",
+       "where\n",
+       "adapt (Project{..}) = (projectName, (projectDescription, projectStars))\n",
+       "
\n", + "\n", + "Infix divided\n", "
\n", - "mapAccumR ∷ (acc → Char → (acc, Char)) → acc → ByteString → (acc, ByteString)(package bytestring, module Data.ByteString.Char8)
The mapAccumR function behaves like a combination of map and foldr; it applies a function to each element of a ByteString, passing an accumulating parameter from right to left, and returning a final value of this accumulator together with the new ByteString. \n", + "divided ∷ Divisible f ⇒ f a → f b → f (a, b)
\n",
+       "divided = divide id\n",
+       "
\n", "
\n", + "(>*<) ∷ Divisible f ⇒ f a → f b → f (a, b)
An alias to divided.\n", "
\n", - "mapAccumL ∷ (a → Char → (a, Char)) → a → Text → (a, Text)(package text, module Data.Text)
O(n) Like a combination of map and foldl'. Applies a function to each element of a Text, passing an accumulating parameter from left to right, and returns a final Text. Performs replacement on invalid scalar values. \n", + "(>*<) ∷ Divisible f ⇒ f a → f b → f (a, b)
An alias to divided.\n", "
\n", + "contrazip2 ∷ Divisible f ⇒ f a1 → f a2 → f (a1, a2)
\n", + "contrazip2 ∷ ∀ f a1 a2 . Divisible f ⇒ f a1 → f a2 → f (a1, a2)
\n", + "pair ∷ Sized f ⇒ f a → f b → f (a, b)
Default: pair a b = (,) $ a * b.\n", "
\n", - "mapAccumR ∷ (a → Char → (a, Char)) → a → Text → (a, Text)(package text, module Data.Text)
The mapAccumR function behaves like a combination of map and a strict foldr; it applies a function to each element of a Text, passing an accumulating parameter from right to left, and returning a final value of this accumulator together with the new Text. Performs replacement on invalid scalar values. \n", - "
\n", - "
\n", - "execRWS ∷ RWS r w s a → r → s → (s, w)(package transformers, module Control.Monad.Trans.RWS.Lazy)
Evaluate a computation with the given initial state and environment, returning the final state and output, discarding the final value. \n", - "
\n", - "
\n", - "breakSubstring ∷ ByteString → ByteString → (ByteString, ByteString)(package bytestring, module Data.ByteString)
otherwise -> Just (length x) \n", - "
\n", - "
\n", - "
For example, to tokenise a string, dropping delimiters:\n", - "
\n", - "
\n", - "
> tokenise x y = h (:) if null t then [] else tokenise x (drop (length x) t)\n", - "> \n", - "
\n", - "
\n", - "
To skip to the first occurence of a string:\n", - "
\n", - "
\n", - "
> snd (breakSubstring x y)\n", - "
\n", - "
\n", - "
To take the parts of a string before a delimiter:\n", - "
\n", - "
\n", - "
> fst (breakSubstring x y) \n", - "
\n", - "
\n", - "breakOn ∷ Text → Text → (Text, Text)(package text, module Data.Text)
O(n+m) Find the first instance of needle (which must be non-null) in haystack. The first element of the returned tuple is the prefix of haystack before needle is matched. The second is the remainder of haystack, starting with the match.\n", - "
\n", - "
\n", - "
Examples:\n", - "
\n", - "
\n", - "
> breakOn \"::\" \"a::b::c\" ==> (\"a\", \"::b::c\")\n", - "> breakOn \"/\" \"foobar\" ==> (\"foobar\", \"\")\n", - "
\n", - "
\n", - "
Laws:\n", - "
\n", - "
\n", - "
> append prefix match == haystack\n", - "> \n", - "
\n", - "
\n", - "
If you need to break a string by a substring repeatedly (e.g. you want to break on every instance of a substring), use breakOnAll instead, as it has lower startup overhead.\n", - "
\n", - "
\n", - "
In (unlikely) bad cases, this function's time complexity degrades towards O(n*m). \n", - "
\n", - "
\n" - ], - "text/plain": [ - "zip :: [a] -> [b] -> [(a, b)]\n", - "URL: http://hackage.haskell.org/packages/archive/base/latest/doc/html/Prelude.html#v:zip\n", - "zip takes two lists and returns a list of corresponding pairs. If one input list is short, excess elements of the longer list are discarded. \n", - "(>*<) :: Monoidal f => f a -> f b -> f (a, b)\n", - "URL: http://hackage.haskell.org/packages/archive/bytestring/latest/doc/html/Data-ByteString-Builder-Prim.html#v:-62--42--60-\n", - "A pairing/concatenation operator for builder primitives, both bounded and fixed size.\n", + "(>*<) ∷ Monoidal f ⇒ f a → f b → f (a, b)
A pairing/concatenation operator for builder primitives, both bounded\n", + "and fixed size.\n", "\n", "For example,\n", "\n", - "> toLazyByteString (primFixed (char7 >*< char7) ('x','y')) = \"xy\"\n", + "
\n",
+       "toLazyByteString (primFixed (char7 >*< char7) ('x','y')) = \"xy\"\n",
+       "
\n", "\n", - "We can combine multiple primitives using >*< multiple times.\n", + "We can combine multiple primitives using >*< multiple\n", + "times.\n", "\n", - "> toLazyByteString (primFixed (char7 >*< char7 >*< char7) ('x',('y','z'))) = \"xyz\" \n", - "shrinkState :: ShrinkState s a => a -> s -> [(a, s)]\n", - "URL: http://hackage.haskell.org/packages/archive/QuickCheck/latest/doc/html/Test-QuickCheck-Modifiers.html#v:shrinkState\n", + "
\n",
+       "toLazyByteString (primFixed (char7 >*< char7 >*< char7) ('x',('y','z'))) = \"xyz\"\n",
+       "
\n", + "
\n", + "(>*<) ∷ Monoidal f ⇒ f a → f b → f (a, b)
Merge two functors into a tuple, analogous to liftA2\n", + "(,). (Sometimes known as **.)\n", + "
\n", + "zip ∷ List l ⇒ l a → l b → l (a, b)
\n", + "zip ∷ Zip f ⇒ f a → f b → f (a, b)
\n", + "zip ∷ (Zip f) ⇒ f a → f b → f (a, b)
\n", + "zip ∷ Zip f ⇒ f a → f b → f (a, b)
\n", + "zip ∷ Zip f ⇒ f a → f b → f (a, b)
\n", + "mzip ∷ MonadZip m ⇒ m a → m b → m (a, b)
\n", + "projectZip ∷ ProductIsoApplicative p ⇒ p a → p b → p (a, b)
Zipping projections.\n", + "
\n", + "(><) ∷ ProductIsoApplicative p ⇒ p a → p b → p (a, b)
Binary operator the same as projectZip.\n", + "
\n", + "projectZip ∷ ProductIsoApplicative p ⇒ p a → p b → p (a, b)
Zipping projections.\n", + "
\n", + "(><) ∷ ProductIsoApplicative p ⇒ p a → p b → p (a, b)
Binary operator the same as projectZip.\n", + "
\n", + "(><) ∷ ProductIsoApplicative p ⇒ p a → p b → p (a, b)
Binary operator the same as projectZip.\n", + "
\n", + "biunfold ∷ (Biunfoldable t, Unfolder f) ⇒ f a → f b → f (t a b)
Given a way to generate elements, return a way to generate structures\n", + "containing those elements.\n", + "
\n", + "biunfoldBF ∷ (Biunfoldable t, Unfolder f) ⇒ f a → f b → f (t a b)
Breadth-first unfold, which orders the result by the number of\n", + "choose calls.\n", + "
\n", + "deserializeWith2 ∷ (Serial2 f, MonadGet m) ⇒ m a → m b → m (f a b)
\n", + "biunfoldRestrict ∷ (BiunfoldableR predA predB t, predA a, predB b, Unfolder f) ⇒ f a → f b → f (t a b)
\n", + "biunfoldRestrictBF ∷ (BiunfoldableR p q t, Unfolder f, p a, q b) ⇒ f a → f b → f (t a b)
\n", + "mesh ∷ Graph g ⇒ [a] → [b] → g (a, b)
Construct a mesh graph from two lists of vertices. Complexity:\n", + "O(L1 * L2) time, memory and size, where L1 and L2\n", + "are the lengths of the given lists.\n", "\n", - "breakOnAll :: Text -> Text -> [(Text, Text)]\n", - "URL: http://hackage.haskell.org/packages/archive/text/latest/doc/html/Data-Text.html#v:breakOnAll\n", - "O(n+m) Find all non-overlapping instances of needle in haystack. Each element of the returned list consists of a pair:\n", + "
\n",
+       "mesh xs     []   == empty\n",
+       "mesh []     ys   == empty\n",
+       "mesh [x]    [y]  == vertex (x, y)\n",
+       "mesh xs     ys   == box (path xs) (path ys)\n",
+       "mesh [1..3] \"ab\" == edges [ ((1,'a'),(1,'b')), ((1,'a'),(2,'a')), ((1,'b'),(2,'b')), ((2,'a'),(2,'b'))\n",
+       ", ((2,'a'),(3,'a')), ((2,'b'),(3,'b')), ((3,'a'),(3,'b')) ]\n",
+       "
\n", + "
\n", + "torus ∷ Graph g ⇒ [a] → [b] → g (a, b)
Construct a torus graph from two lists of vertices. Complexity:\n", + "O(L1 * L2) time, memory and size, where L1 and L2\n", + "are the lengths of the given lists.\n", "\n", - "* The entire string prior to the kth match (i.e. the prefix)\n", - "* The kth match, followed by the remainder of the string\n", + "
\n",
+       "torus xs    []   == empty\n",
+       "torus []    ys   == empty\n",
+       "torus [x]   [y]  == edge (x,y) (x,y)\n",
+       "torus xs    ys   == box (circuit xs) (circuit ys)\n",
+       "torus [1,2] \"ab\" == edges [ ((1,'a'),(1,'b')), ((1,'a'),(2,'a')), ((1,'b'),(1,'a')), ((1,'b'),(2,'b'))\n",
+       ", ((2,'a'),(1,'a')), ((2,'a'),(2,'b')), ((2,'b'),(1,'b')), ((2,'b'),(2,'a')) ]\n",
+       "
\n", + "
\n", + "zipExactMay ∷ [a] → [b] → Maybe [(a, b)]
\n" + ], + "text/plain": [ + "zip :: [a] -> [b] -> [(a, b)]\n", + "URL: https://hackage.haskell.org/package/base/docs/Prelude.html#v:zip\n", + "zip takes two lists and returns a list of corresponding pairs.\n", "\n", - "Examples:\n", + "
\n",
+       "zip [1, 2] ['a', 'b'] = [(1, 'a'), (2, 'b')]\n",
+       "
\n", "\n", - "> breakOnAll \"::\" \"\"\n", - "> ==> []\n", - "> breakOnAll \"/\" \"a/b/c/\"\n", - "> ==> [(\"a\", \"/b/c/\"), (\"a/b\", \"/c/\"), (\"a/b/c\", \"/\")]\n", + "If one input list is short, excess elements of the longer list are\n", + "discarded:\n", "\n", - "In (unlikely) bad cases, this function's time complexity degrades towards O(n*m).\n", + "
\n",
+       "zip [1] ['a', 'b'] = [(1, 'a')]\n",
+       "zip [1, 2] ['a'] = [(1, 'a')]\n",
+       "
\n", "\n", - "The needle parameter may not be empty. \n", - "breakOnAll :: Text -> Text -> [(Text, Text)]\n", - "URL: http://hackage.haskell.org/packages/archive/text/latest/doc/html/Data-Text-Lazy.html#v:breakOnAll\n", - "O(n+m) Find all non-overlapping instances of needle in haystack. Each element of the returned list consists of a pair:\n", + "zip is right-lazy:\n", "\n", - "* The entire string prior to the kth match (i.e. the prefix)\n", - "* The kth match, followed by the remainder of the string\n", + "
\n",
+       "zip [] _|_ = []\n",
+       "zip _|_ [] = _|_\n",
+       "
\n", "\n", - "Examples:\n", + "zip :: [a] -> [b] -> [(a, b)]\n", + "URL: https://hackage.haskell.org/package/base/docs/Data-List.html#v:zip\n", + "zip takes two lists and returns a list of corresponding pairs.\n", "\n", - "> breakOnAll \"::\" \"\"\n", - "> ==> []\n", - "> breakOnAll \"/\" \"a/b/c/\"\n", - "> ==> [(\"a\", \"/b/c/\"), (\"a/b\", \"/c/\"), (\"a/b/c\", \"/\")]\n", + "
\n",
+       "zip [1, 2] ['a', 'b'] = [(1, 'a'), (2, 'b')]\n",
+       "
\n", "\n", - "This function is strict in its first argument, and lazy in its second.\n", + "If one input list is short, excess elements of the longer list are\n", + "discarded:\n", "\n", - "In (unlikely) bad cases, this function's time complexity degrades towards O(n*m).\n", + "
\n",
+       "zip [1] ['a', 'b'] = [(1, 'a')]\n",
+       "zip [1, 2] ['a'] = [(1, 'a')]\n",
+       "
\n", "\n", - "The needle parameter may not be empty. \n", - "genLNodes :: Enum a => a -> Int -> [LNode a]\n", - "URL: http://hackage.haskell.org/packages/archive/fgl/latest/doc/html/Data-Graph-Inductive-Example.html#v:genLNodes\n", - "generate list of labeled nodes \n", - "gmapAccumT :: Data d => (forall e. Data e => a -> e -> (a, e)) -> a -> d -> (a, d)\n", - "URL: http://hackage.haskell.org/packages/archive/syb/latest/doc/html/Data-Generics-Twins.html#v:gmapAccumT\n", - "gmapT with accumulation \n", - "threadList :: (Collect r c) -> (Split t i r) -> [i] -> t -> (c, t)\n", - "URL: http://hackage.haskell.org/packages/archive/fgl/latest/doc/html/Data-Graph-Inductive-Internal-Thread.html#v:threadList\n", + "zip is right-lazy:\n", "\n", - "threadList' :: (Collect r c) -> (Split t i r) -> [i] -> t -> (c, t)\n", - "URL: http://hackage.haskell.org/packages/archive/fgl/latest/doc/html/Data-Graph-Inductive-Internal-Thread.html#v:threadList-39-\n", + "
\n",
+       "zip [] _|_ = []\n",
+       "zip _|_ [] = _|_\n",
+       "
\n", "\n", - "mapAccumL :: (acc -> Word8 -> (acc, Word8)) -> acc -> ByteString -> (acc, ByteString)\n", - "URL: http://hackage.haskell.org/packages/archive/bytestring/latest/doc/html/Data-ByteString-Lazy.html#v:mapAccumL\n", - "The mapAccumL function behaves like a combination of map and foldl; it applies a function to each element of a ByteString, passing an accumulating parameter from left to right, and returning a final value of this accumulator together with the new ByteString. \n", - "mapAccumL :: (acc -> Word8 -> (acc, Word8)) -> acc -> ByteString -> (acc, ByteString)\n", - "URL: http://hackage.haskell.org/packages/archive/bytestring/latest/doc/html/Data-ByteString.html#v:mapAccumL\n", - "The mapAccumL function behaves like a combination of map and foldl; it applies a function to each element of a ByteString, passing an accumulating parameter from left to right, and returning a final value of this accumulator together with the new list. \n", - "mapAccumR :: (acc -> Word8 -> (acc, Word8)) -> acc -> ByteString -> (acc, ByteString)\n", - "URL: http://hackage.haskell.org/packages/archive/bytestring/latest/doc/html/Data-ByteString.html#v:mapAccumR\n", - "The mapAccumR function behaves like a combination of map and foldr; it applies a function to each element of a ByteString, passing an accumulating parameter from right to left, and returning a final value of this accumulator together with the new ByteString. \n", - "mapAccumL :: (acc -> Char -> (acc, Char)) -> acc -> ByteString -> (acc, ByteString)\n", - "URL: http://hackage.haskell.org/packages/archive/bytestring/latest/doc/html/Data-ByteString-Lazy-Char8.html#v:mapAccumL\n", - "The mapAccumL function behaves like a combination of map and foldl; it applies a function to each element of a ByteString, passing an accumulating parameter from left to right, and returning a final value of this accumulator together with the new ByteString. \n", - "mapAccumL :: (acc -> Char -> (acc, Char)) -> acc -> ByteString -> (acc, ByteString)\n", - "URL: http://hackage.haskell.org/packages/archive/bytestring/latest/doc/html/Data-ByteString-Char8.html#v:mapAccumL\n", - "The mapAccumL function behaves like a combination of map and foldl; it applies a function to each element of a ByteString, passing an accumulating parameter from left to right, and returning a final value of this accumulator together with the new list. \n", - "mapAccumR :: (acc -> Char -> (acc, Char)) -> acc -> ByteString -> (acc, ByteString)\n", - "URL: http://hackage.haskell.org/packages/archive/bytestring/latest/doc/html/Data-ByteString-Char8.html#v:mapAccumR\n", - "The mapAccumR function behaves like a combination of map and foldr; it applies a function to each element of a ByteString, passing an accumulating parameter from right to left, and returning a final value of this accumulator together with the new ByteString. \n", - "mapAccumL :: (a -> Char -> (a, Char)) -> a -> Text -> (a, Text)\n", - "URL: http://hackage.haskell.org/packages/archive/text/latest/doc/html/Data-Text.html#v:mapAccumL\n", - "O(n) Like a combination of map and foldl'. Applies a function to each element of a Text, passing an accumulating parameter from left to right, and returns a final Text. Performs replacement on invalid scalar values. \n", - "mapAccumR :: (a -> Char -> (a, Char)) -> a -> Text -> (a, Text)\n", - "URL: http://hackage.haskell.org/packages/archive/text/latest/doc/html/Data-Text.html#v:mapAccumR\n", - "The mapAccumR function behaves like a combination of map and a strict foldr; it applies a function to each element of a Text, passing an accumulating parameter from right to left, and returning a final value of this accumulator together with the new Text. Performs replacement on invalid scalar values. \n", - "execRWS :: RWS r w s a -> r -> s -> (s, w)\n", - "URL: http://hackage.haskell.org/packages/archive/transformers/latest/doc/html/Control-Monad-Trans-RWS-Lazy.html#v:execRWS\n", - "Evaluate a computation with the given initial state and environment, returning the final state and output, discarding the final value. \n", - "breakSubstring :: ByteString -> ByteString -> (ByteString, ByteString)\n", - "URL: http://hackage.haskell.org/packages/archive/bytestring/latest/doc/html/Data-ByteString.html#v:breakSubstring\n", - "otherwise -> Just (length x) \n", + "zip :: [a] -> [b] -> [(a, b)]\n", + "URL: https://hackage.haskell.org/package/base/docs/GHC-List.html#v:zip\n", + "zip takes two lists and returns a list of corresponding pairs.\n", "\n", - "For example, to tokenise a string, dropping delimiters:\n", + "
\n",
+       "zip [1, 2] ['a', 'b'] = [(1, 'a'), (2, 'b')]\n",
+       "
\n", "\n", - "> tokenise x y = h (:) if null t then [] else tokenise x (drop (length x) t)\n", - "> \n", + "If one input list is short, excess elements of the longer list are\n", + "discarded:\n", "\n", - "To skip to the first occurence of a string:\n", + "
\n",
+       "zip [1] ['a', 'b'] = [(1, 'a')]\n",
+       "zip [1, 2] ['a'] = [(1, 'a')]\n",
+       "
\n", "\n", - "> snd (breakSubstring x y)\n", + "zip is right-lazy:\n", "\n", - "To take the parts of a string before a delimiter:\n", + "
\n",
+       "zip [] _|_ = []\n",
+       "zip _|_ [] = _|_\n",
+       "
\n", "\n", - "> fst (breakSubstring x y) \n", - "breakOn :: Text -> Text -> (Text, Text)\n", - "URL: http://hackage.haskell.org/packages/archive/text/latest/doc/html/Data-Text.html#v:breakOn\n", - "O(n+m) Find the first instance of needle (which must be non-null) in haystack. The first element of the returned tuple is the prefix of haystack before needle is matched. The second is the remainder of haystack, starting with the match.\n", + "zip :: [a] -> [b] -> [(a, b)]\n", + "URL: https://hackage.haskell.org/package/base/docs/GHC-OldList.html#v:zip\n", + "zip takes two lists and returns a list of corresponding pairs.\n", "\n", - "Examples:\n", + "
\n",
+       "zip [1, 2] ['a', 'b'] = [(1, 'a'), (2, 'b')]\n",
+       "
\n", "\n", - "> breakOn \"::\" \"a::b::c\" ==> (\"a\", \"::b::c\")\n", - "> breakOn \"/\" \"foobar\" ==> (\"foobar\", \"\")\n", + "If one input list is short, excess elements of the longer list are\n", + "discarded:\n", "\n", - "Laws:\n", + "
\n",
+       "zip [1] ['a', 'b'] = [(1, 'a')]\n",
+       "zip [1, 2] ['a'] = [(1, 'a')]\n",
+       "
\n", "\n", - "> append prefix match == haystack\n", - "> \n", + "zip is right-lazy:\n", "\n", - "If you need to break a string by a substring repeatedly (e.g. you want to break on every instance of a substring), use breakOnAll instead, as it has lower startup overhead.\n", + "
\n",
+       "zip [] _|_ = []\n",
+       "zip _|_ [] = _|_\n",
+       "
\n", "\n", - "In (unlikely) bad cases, this function's time complexity degrades towards O(n*m)." + "zip :: () => [a] -> [b] -> [(a, b)]\n", + "URL: https://hackage.haskell.org/package/hspec/docs/Test-Hspec-Discover.html#v:zip\n", + "zip takes two lists and returns a list of corresponding pairs.\n", + "If one input list is short, excess elements of the longer list are\n", + "discarded.\n", + "\n", + "zip is right-lazy:\n", + "\n", + "
\n",
+       "zip [] _|_ = []\n",
+       "
\n", + "\n", + "zip :: () => [a] -> [b] -> [(a, b)]\n", + "URL: https://hackage.haskell.org/package/Cabal/docs/Distribution-Compat-Prelude-Internal.html#v:zip\n", + "zip takes two lists and returns a list of corresponding pairs.\n", + "If one input list is short, excess elements of the longer list are\n", + "discarded.\n", + "\n", + "zip is right-lazy:\n", + "\n", + "
\n",
+       "zip [] _|_ = []\n",
+       "
\n", + "\n", + "zipExact :: Partial => [a] -> [b] -> [(a, b)]\n", + "URL: https://hackage.haskell.org/package/safe/docs/Safe-Exact.html#v:zipExact\n", + "
\n",
+       "zipExact xs ys =\n",
+       "| length xs == length ys = zip xs ys\n",
+       "| otherwise              = error \"some message\"\n",
+       "
\n", + "\n", + "zip :: () => [a] -> [b] -> [(a, b)]\n", + "URL: https://hackage.haskell.org/package/base-compat/docs/Prelude-Compat.html#v:zip\n", + "zip takes two lists and returns a list of corresponding pairs.\n", + "If one input list is short, excess elements of the longer list are\n", + "discarded.\n", + "\n", + "zip is right-lazy:\n", + "\n", + "
\n",
+       "zip [] _|_ = []\n",
+       "
\n", + "\n", + "zip :: () => [a] -> [b] -> [(a, b)]\n", + "URL: https://hackage.haskell.org/package/protolude/docs/Protolude.html#v:zip\n", + "zip takes two lists and returns a list of corresponding pairs.\n", + "If one input list is short, excess elements of the longer list are\n", + "discarded.\n", + "\n", + "zip is right-lazy:\n", + "\n", + "
\n",
+       "zip [] _|_ = []\n",
+       "
\n", + "\n", + "zip :: () => [a] -> [b] -> [(a, b)]\n", + "URL: https://hackage.haskell.org/package/numeric-prelude/docs/NumericPrelude.html#v:zip\n", + "zip takes two lists and returns a list of corresponding pairs.\n", + "If one input list is short, excess elements of the longer list are\n", + "discarded.\n", + "\n", + "zip is right-lazy:\n", + "\n", + "
\n",
+       "zip [] _|_ = []\n",
+       "
\n", + "\n", + "zip :: () => [a] -> [b] -> [(a, b)]\n", + "URL: https://hackage.haskell.org/package/numeric-prelude/docs/NumericPrelude-Base.html#v:zip\n", + "zip takes two lists and returns a list of corresponding pairs.\n", + "If one input list is short, excess elements of the longer list are\n", + "discarded.\n", + "\n", + "zip is right-lazy:\n", + "\n", + "
\n",
+       "zip [] _|_ = []\n",
+       "
\n", + "\n", + "zip :: () => [a] -> [b] -> [(a, b)]\n", + "URL: https://hackage.haskell.org/package/rio/docs/RIO.html#v:zip\n", + "zip takes two lists and returns a list of corresponding pairs.\n", + "If one input list is short, excess elements of the longer list are\n", + "discarded.\n", + "\n", + "zip is right-lazy:\n", + "\n", + "
\n",
+       "zip [] _|_ = []\n",
+       "
\n", + "\n", + "zip :: () => [a] -> [b] -> [(a, b)]\n", + "URL: https://hackage.haskell.org/package/rio/docs/RIO-List.html#v:zip\n", + "zip takes two lists and returns a list of corresponding pairs.\n", + "If one input list is short, excess elements of the longer list are\n", + "discarded.\n", + "\n", + "zip is right-lazy:\n", + "\n", + "
\n",
+       "zip [] _|_ = []\n",
+       "
\n", + "\n", + "zip :: () => [a] -> [b] -> [(a, b)]\n", + "URL: https://hackage.haskell.org/package/rebase/docs/Rebase-Prelude.html#v:zip\n", + "zip takes two lists and returns a list of corresponding pairs.\n", + "If one input list is short, excess elements of the longer list are\n", + "discarded.\n", + "\n", + "zip is right-lazy:\n", + "\n", + "
\n",
+       "zip [] _|_ = []\n",
+       "
\n", + "\n", + "zip :: [a] -> [b] -> [(a, b)]\n", + "URL: https://hackage.haskell.org/package/fay-base/docs/Prelude.html#v:zip\n", + "\n", + "(+*+) :: [a] -> [b] -> [(a, b)]\n", + "URL: https://hackage.haskell.org/package/universe-base/docs/Data-Universe-Helpers.html#v:-43--42--43-\n", + "Slightly unfair 2-way Cartesian product: given two (possibly infinite)\n", + "lists, produce a single list such that whenever v and\n", + "w have finite indices in the input lists, (v,w) has\n", + "finite index in the output list. Lower indices occur as the\n", + "fst part of the tuple more frequently, but not exponentially\n", + "so.\n", + "\n", + "unfairCartesianProduct :: [a] -> [b] -> [(a, b)]\n", + "URL: https://hackage.haskell.org/package/universe-base/docs/Data-Universe-Helpers.html#v:unfairCartesianProduct\n", + "Very unfair 2-way Cartesian product: same guarantee as the slightly\n", + "unfair one, except that lower indices may occur as the fst\n", + "part of the tuple exponentially more frequently. This mainly exists as\n", + "a specification to test against.\n", + "\n", + "zip :: () => [a] -> [b] -> [(a, b)]\n", + "URL: https://hackage.haskell.org/package/llvm-hs-pure/docs/LLVM-Prelude.html#v:zip\n", + "zip takes two lists and returns a list of corresponding pairs.\n", + "If one input list is short, excess elements of the longer list are\n", + "discarded.\n", + "\n", + "zip is right-lazy:\n", + "\n", + "
\n",
+       "zip [] _|_ = []\n",
+       "
\n", + "\n", + "zip :: () => [a] -> [b] -> [(a, b)]\n", + "URL: https://hackage.haskell.org/package/universum/docs/Universum-List-Reexport.html#v:zip\n", + "zip takes two lists and returns a list of corresponding pairs.\n", + "If one input list is short, excess elements of the longer list are\n", + "discarded.\n", + "\n", + "zip is right-lazy:\n", + "\n", + "
\n",
+       "zip [] _|_ = []\n",
+       "
\n", + "\n", + "zip :: () => [a] -> [b] -> [(a, b)]\n", + "URL: https://hackage.haskell.org/package/haxl/docs/Haxl-Prelude.html#v:zip\n", + "zip takes two lists and returns a list of corresponding pairs.\n", + "If one input list is short, excess elements of the longer list are\n", + "discarded.\n", + "\n", + "zip is right-lazy:\n", + "\n", + "
\n",
+       "zip [] _|_ = []\n",
+       "
\n", + "\n", + "zip :: [a] -> [b] -> [(a, b)]\n", + "URL: https://hackage.haskell.org/package/prelude-compat/docs/Data-List2010.html#v:zip\n", + "\n", + "zip :: [a] -> [b] -> [(a, b)]\n", + "URL: https://hackage.haskell.org/package/prelude-compat/docs/Prelude2010.html#v:zip\n", + "\n", + "zip :: [a] -> [b] -> [(a, b)]\n", + "URL: https://hackage.haskell.org/package/EdisonAPI/docs/Data-Edison-Seq-ListSeq.html#v:zip\n", + "\n", + "zip :: () => [a] -> [b] -> [(a, b)]\n", + "URL: https://hackage.haskell.org/package/LambdaHack/docs/Game-LambdaHack-Common-Prelude.html#v:zip\n", + "zip takes two lists and returns a list of corresponding pairs.\n", + "If one input list is short, excess elements of the longer list are\n", + "discarded.\n", + "\n", + "zip is right-lazy:\n", + "\n", + "
\n",
+       "zip [] _|_ = []\n",
+       "
\n", + "\n", + "zip :: () => [a] -> [b] -> [(a, b)]\n", + "URL: https://hackage.haskell.org/package/LambdaHack/docs/Game-LambdaHack-Common-Prelude.html#v:zip\n", + "zip takes two lists and returns a list of corresponding pairs.\n", + "If one input list is short, excess elements of the longer list are\n", + "discarded.\n", + "\n", + "zip is right-lazy:\n", + "\n", + "
\n",
+       "zip [] _|_ = []\n",
+       "
\n", + "\n", + "zip :: () => [a] -> [b] -> [(a, b)]\n", + "URL: https://hackage.haskell.org/package/intro/docs/Intro.html#v:zip\n", + "zip takes two lists and returns a list of corresponding pairs.\n", + "If one input list is short, excess elements of the longer list are\n", + "discarded.\n", + "\n", + "zip is right-lazy:\n", + "\n", + "
\n",
+       "zip [] _|_ = []\n",
+       "
\n", + "\n", + "zip :: () => [a] -> [b] -> [(a, b)]\n", + "URL: https://hackage.haskell.org/package/yesod-paginator/docs/Yesod-Paginator-Prelude.html#v:zip\n", + "zip takes two lists and returns a list of corresponding pairs.\n", + "If one input list is short, excess elements of the longer list are\n", + "discarded.\n", + "\n", + "zip is right-lazy:\n", + "\n", + "
\n",
+       "zip [] _|_ = []\n",
+       "
\n", + "\n", + "zip :: () => [a] -> [b] -> [(a, b)]\n", + "URL: https://hackage.haskell.org/package/hledger-web/docs/Hledger-Web-Import.html#v:zip\n", + "zip takes two lists and returns a list of corresponding pairs.\n", + "If one input list is short, excess elements of the longer list are\n", + "discarded.\n", + "\n", + "zip is right-lazy:\n", + "\n", + "
\n",
+       "zip [] _|_ = []\n",
+       "
\n", + "\n", + "zip :: () => [a] -> [b] -> [(a, b)]\n", + "URL: https://hackage.haskell.org/package/relude/docs/Relude-List-Reexport.html#v:zip\n", + "zip takes two lists and returns a list of corresponding pairs.\n", + "If one input list is short, excess elements of the longer list are\n", + "discarded.\n", + "\n", + "zip is right-lazy:\n", + "\n", + "
\n",
+       "zip [] _|_ = []\n",
+       "
\n", + "\n", + "zipLazy :: [a] -> [b] -> [(a, b)]\n", + "URL: https://hackage.haskell.org/package/ghc/docs/Util.html#v:zipLazy\n", + "zipLazy is a kind of zip that is lazy in the second list\n", + "(observe the ~)\n", + "\n", + "concurrently :: MonadBaseControl IO m => m a -> m b -> m (a, b)\n", + "URL: https://hackage.haskell.org/package/lifted-async/docs/Control-Concurrent-Async-Lifted.html#v:concurrently\n", + "Generalized version of concurrently.\n", + "\n", + "concurrently :: forall m a b . (MonadBaseControl IO m, Forall (Pure m)) => m a -> m b -> m (a, b)\n", + "URL: https://hackage.haskell.org/package/lifted-async/docs/Control-Concurrent-Async-Lifted-Safe.html#v:concurrently\n", + "Generalized version of concurrently.\n", + "\n", + "pairADefault :: Applicative f => f a -> f b -> f (a, b)\n", + "URL: https://hackage.haskell.org/package/invertible/docs/Control-Invertible-Monoidal.html#v:pairADefault\n", + "Default '>*< implementation for non-invertible\n", + "Applicatives.\n", + "\n", + "zip :: (Vector v a, Vector v b, Vector v (a, b)) => v a -> v b -> v (a, b)\n", + "URL: https://hackage.haskell.org/package/vector/docs/Data-Vector-Generic.html#v:zip\n", + "O(min(m,n)) Zip two vectors\n", + "\n", + "pair :: (Vector v a, Vector v b, Vector v (a, b)) => v a -> v b -> v (a, b)\n", + "URL: https://hackage.haskell.org/package/statistics/docs/Statistics-Sample.html#v:pair\n", + "Pair two samples. It's like zip but requires that both samples\n", + "have equal size.\n", + "\n", + "zip :: (Vector v a, Vector v b, Vector v (a, b)) => v a -> v b -> v (a, b)\n", + "URL: https://hackage.haskell.org/package/rio/docs/RIO-Vector.html#v:zip\n", + "O(min(m,n)) Zip two vectors\n", + "\n", + "concurrently :: MonadUnliftIO m => m a -> m b -> m (a, b)\n", + "URL: https://hackage.haskell.org/package/unliftio/docs/UnliftIO-Async.html#v:concurrently\n", + "Unlifted concurrently.\n", + "\n", + "concurrently :: MonadUnliftIO m => m a -> m b -> m (a, b)\n", + "URL: https://hackage.haskell.org/package/yesod-websockets/docs/Yesod-WebSockets.html#v:concurrently\n", + "Unlifted concurrently.\n", + "\n", + "zip :: Sequence s => s a -> s b -> s (a, b)\n", + "URL: https://hackage.haskell.org/package/EdisonAPI/docs/Data-Edison-Seq.html#v:zip\n", + "Combine two sequences into a sequence of pairs. If the sequences are\n", + "different lengths, the excess elements of the longer sequence is\n", + "discarded.\n", + "\n", + "
\n",
+       "zip <x0,...,xn-1> <y0,...,ym-1> = <(x0,y0),...,(xj-1,yj-1)>\n",
+       "where j = min {n,m}\n",
+       "
\n", + "\n", + "Axioms:\n", + "\n", + "
    \n", + "
  • zip xs ys = zipWith (,) xs ys
  • \n", + "
\n", + "\n", + "This function is always unambiguous.\n", + "\n", + "Default running time: O( min( n1, n2 ) )\n", + "\n", + "zipUsingLview :: Sequence s => s a -> s b -> s (a, b)\n", + "URL: https://hackage.haskell.org/package/EdisonCore/docs/Data-Edison-Seq-Defaults.html#v:zipUsingLview\n", + "\n", + "zipUsingLists :: Sequence s => s a -> s b -> s (a, b)\n", + "URL: https://hackage.haskell.org/package/EdisonCore/docs/Data-Edison-Seq-Defaults.html#v:zipUsingLists\n", + "\n", + "concurrently :: MonadConc m => m a -> m b -> m (a, b)\n", + "URL: https://hackage.haskell.org/package/concurrency/docs/Control-Concurrent-Classy-Async.html#v:concurrently\n", + "Run two MonadConc actions concurrently, and return both\n", + "results. If either action throws an exception at any time, then the\n", + "other action is cancelled, and the exception is re-thrown by\n", + "concurrently.\n", + "\n", + "
\n",
+       "concurrently left right =\n",
+       "withAsync left $ \\a ->\n",
+       "withAsync right $ \\b ->\n",
+       "waitBoth a b\n",
+       "
\n", + "\n", + "mzipRep :: Representable f => f a -> f b -> f (a, b)\n", + "URL: https://hackage.haskell.org/package/adjunctions/docs/Data-Functor-Rep.html#v:mzipRep\n", + "\n", + "box :: Graph g => g a -> g b -> g (a, b)\n", + "URL: https://hackage.haskell.org/package/algebraic-graphs/docs/Algebra-Graph-HigherKinded-Class.html#v:box\n", + "Compute the Cartesian product of graphs. Complexity: O(s1 *\n", + "s2) time, memory and size, where s1 and s2 are the\n", + "sizes of the given graphs.\n", + "\n", + "
\n",
+       "box (path [0,1]) (path \"ab\") == edges [ ((0,'a'), (0,'b'))\n",
+       ", ((0,'a'), (1,'a'))\n",
+       ", ((0,'b'), (1,'b'))\n",
+       ", ((1,'a'), (1,'b')) ]\n",
+       "
\n", + "\n", + "Up to an isomorphism between the resulting vertex types, this\n", + "operation is commutative, associative,\n", + "distributes over overlay, has singleton graphs as\n", + "identities and empty as the annihilating zero.\n", + "Below ~~ stands for the equality up to an isomorphism, e.g.\n", + "(x, ()) ~~ x.\n", + "\n", + "
\n",
+       "box x y               ~~ box y x\n",
+       "box x (box y z)       ~~ box (box x y) z\n",
+       "box x (overlay y z)   == overlay (box x y) (box x z)\n",
+       "box x (vertex ())     ~~ x\n",
+       "box x empty           ~~ empty\n",
+       "vertexCount (box x y) == vertexCount x * vertexCount y\n",
+       "edgeCount   (box x y) <= vertexCount x * edgeCount y + edgeCount x * vertexCount y\n",
+       "
\n", + "\n", + "divided :: Divisible f => f a -> f b -> f (a, b)\n", + "URL: https://hackage.haskell.org/package/contravariant/docs/Data-Functor-Contravariant-Divisible.html#v:divided\n", + "
\n",
+       "divided = divide id\n",
+       "
\n", + "\n", + "(>*<) :: Divisible f => f a -> f b -> f (a, b)\n", + "URL: https://hackage.haskell.org/package/dhall/docs/Dhall.html#v:-62--42--60-\n", + "The RecordInputType divisible (contravariant) functor allows\n", + "you to build an InputType injector for a Dhall record.\n", + "\n", + "For example, let's take the following Haskell data type:\n", + "\n", + "
\n",
+       "data Project = Project\n",
+       "{ projectName :: Text\n",
+       ", projectDescription :: Text\n",
+       ", projectStars :: Natural\n",
+       "}\n",
+       "
\n", + "\n", + "And assume that we have the following Dhall record that we would like\n", + "to parse as a Project:\n", + "\n", + "
\n",
+       "{ name =\n",
+       "\"dhall-haskell\"\n",
+       ", description =\n",
+       "\"A configuration language guaranteed to terminate\"\n",
+       ", stars =\n",
+       "289\n",
+       "}\n",
+       "
\n", + "\n", + "Our injector has type InputType Project, but we can't\n", + "build that out of any smaller injectors, as InputTypes cannot\n", + "be combined (they are only Contravariants). However, we can use\n", + "an InputRecordType to build an InputType for\n", + "Project:\n", + "\n", + "
\n",
+       "injectProject :: InputType Project\n",
+       "injectProject =\n",
+       "inputRecord\n",
+       "(  adapt >$< inputFieldWith \"name\" inject\n",
+       ">*< inputFieldWith \"description\" inject\n",
+       ">*< inputFieldWith \"stars\" inject\n",
+       ")\n",
+       "where\n",
+       "adapt (Project{..}) = (projectName, (projectDescription, projectStars))\n",
+       "
\n", + "\n", + "Or, since we are simply using the Inject instance to inject\n", + "each field, we could write\n", + "\n", + "
\n",
+       "injectProject :: InputType Project\n",
+       "injectProject =\n",
+       "inputRecord\n",
+       "(  adapt >$< inputField \"name\"\n",
+       ">*< inputField \"description\"\n",
+       ">*< inputField \"stars\"\n",
+       ")\n",
+       "where\n",
+       "adapt (Project{..}) = (projectName, (projectDescription, projectStars))\n",
+       "
\n", + "\n", + "Infix divided\n", + "\n", + "divided :: Divisible f => f a -> f b -> f (a, b)\n", + "URL: https://hackage.haskell.org/package/rebase/docs/Rebase-Prelude.html#v:divided\n", + "
\n",
+       "divided = divide id\n",
+       "
\n", + "\n", + "(>*<) :: Divisible f => f a -> f b -> f (a, b)\n", + "URL: https://hackage.haskell.org/package/rebase/docs/Rebase-Prelude.html#v:-62--42--60-\n", + "An alias to divided.\n", + "\n", + "(>*<) :: Divisible f => f a -> f b -> f (a, b)\n", + "URL: https://hackage.haskell.org/package/contravariant-extras/docs/Contravariant-Extras.html#v:-62--42--60-\n", + "An alias to divided.\n", + "\n", + "contrazip2 :: Divisible f => f a1 -> f a2 -> f (a1, a2)\n", + "URL: https://hackage.haskell.org/package/rebase/docs/Rebase-Prelude.html#v:contrazip2\n", + "\n", + "contrazip2 :: forall f a1 a2 . Divisible f => f a1 -> f a2 -> f (a1, a2)\n", + "URL: https://hackage.haskell.org/package/contravariant-extras/docs/Contravariant-Extras-Contrazip.html#v:contrazip2\n", + "\n", + "pair :: Sized f => f a -> f b -> f (a, b)\n", + "URL: https://hackage.haskell.org/package/size-based/docs/Control-Sized.html#v:pair\n", + "Default: pair a b = (,) $ a * b.\n", + "\n", + "(>*<) :: Monoidal f => f a -> f b -> f (a, b)\n", + "URL: https://hackage.haskell.org/package/bytestring/docs/Data-ByteString-Builder-Prim.html#v:-62--42--60-\n", + "A pairing/concatenation operator for builder primitives, both bounded\n", + "and fixed size.\n", + "\n", + "For example,\n", + "\n", + "
\n",
+       "toLazyByteString (primFixed (char7 >*< char7) ('x','y')) = \"xy\"\n",
+       "
\n", + "\n", + "We can combine multiple primitives using >*< multiple\n", + "times.\n", + "\n", + "
\n",
+       "toLazyByteString (primFixed (char7 >*< char7 >*< char7) ('x',('y','z'))) = \"xyz\"\n",
+       "
\n", + "\n", + "(>*<) :: Monoidal f => f a -> f b -> f (a, b)\n", + "URL: https://hackage.haskell.org/package/invertible/docs/Control-Invertible-Monoidal.html#v:-62--42--60-\n", + "Merge two functors into a tuple, analogous to liftA2\n", + "(,). (Sometimes known as **.)\n", + "\n", + "zip :: List l => l a -> l b -> l (a, b)\n", + "URL: https://hackage.haskell.org/package/List/docs/Data-List-Class.html#v:zip\n", + "\n", + "zip :: Zip f => f a -> f b -> f (a, b)\n", + "URL: https://hackage.haskell.org/package/classy-prelude/docs/ClassyPrelude.html#v:zip\n", + "\n", + "zip :: (Zip f) => f a -> f b -> f (a, b)\n", + "URL: https://hackage.haskell.org/package/non-empty/docs/Data-NonEmpty-Class.html#v:zip\n", + "\n", + "zip :: Zip f => f a -> f b -> f (a, b)\n", + "URL: https://hackage.haskell.org/package/keys/docs/Data-Key.html#v:zip\n", + "\n", + "zip :: Zip f => f a -> f b -> f (a, b)\n", + "URL: https://hackage.haskell.org/package/chunked-data/docs/Data-ChunkedZip.html#v:zip\n", + "\n", + "mzip :: MonadZip m => m a -> m b -> m (a, b)\n", + "URL: https://hackage.haskell.org/package/base/docs/Control-Monad-Zip.html#v:mzip\n", + "\n", + "projectZip :: ProductIsoApplicative p => p a -> p b -> p (a, b)\n", + "URL: https://hackage.haskell.org/package/relational-query/docs/Database-Relational-Arrow.html#v:projectZip\n", + "Zipping projections.\n", + "\n", + "(><) :: ProductIsoApplicative p => p a -> p b -> p (a, b)\n", + "URL: https://hackage.haskell.org/package/relational-query/docs/Database-Relational-Arrow.html#v:-62--60-\n", + "Binary operator the same as projectZip.\n", + "\n", + "projectZip :: ProductIsoApplicative p => p a -> p b -> p (a, b)\n", + "URL: https://hackage.haskell.org/package/relational-query/docs/Database-Relational-Projectable.html#v:projectZip\n", + "Zipping projections.\n", + "\n", + "(><) :: ProductIsoApplicative p => p a -> p b -> p (a, b)\n", + "URL: https://hackage.haskell.org/package/relational-query/docs/Database-Relational-Projectable.html#v:-62--60-\n", + "Binary operator the same as projectZip.\n", + "\n", + "(><) :: ProductIsoApplicative p => p a -> p b -> p (a, b)\n", + "URL: https://hackage.haskell.org/package/relational-record/docs/Database-Relational-Documentation.html#v:-62--60-\n", + "Binary operator the same as projectZip.\n", + "\n", + "biunfold :: (Biunfoldable t, Unfolder f) => f a -> f b -> f (t a b)\n", + "URL: https://hackage.haskell.org/package/unfoldable/docs/Data-Biunfoldable.html#v:biunfold\n", + "Given a way to generate elements, return a way to generate structures\n", + "containing those elements.\n", + "\n", + "biunfoldBF :: (Biunfoldable t, Unfolder f) => f a -> f b -> f (t a b)\n", + "URL: https://hackage.haskell.org/package/unfoldable/docs/Data-Biunfoldable.html#v:biunfoldBF\n", + "Breadth-first unfold, which orders the result by the number of\n", + "choose calls.\n", + "\n", + "deserializeWith2 :: (Serial2 f, MonadGet m) => m a -> m b -> m (f a b)\n", + "URL: https://hackage.haskell.org/package/bytes/docs/Data-Bytes-Serial.html#v:deserializeWith2\n", + "\n", + "biunfoldRestrict :: (BiunfoldableR predA predB t, predA a, predB b, Unfolder f) => f a -> f b -> f (t a b)\n", + "URL: https://hackage.haskell.org/package/unfoldable-restricted/docs/Data-Unfoldable-Restricted.html#v:biunfoldRestrict\n", + "\n", + "biunfoldRestrictBF :: (BiunfoldableR p q t, Unfolder f, p a, q b) => f a -> f b -> f (t a b)\n", + "URL: https://hackage.haskell.org/package/unfoldable-restricted/docs/Data-Unfoldable-Restricted.html#v:biunfoldRestrictBF\n", + "\n", + "mesh :: Graph g => [a] -> [b] -> g (a, b)\n", + "URL: https://hackage.haskell.org/package/algebraic-graphs/docs/Algebra-Graph-HigherKinded-Class.html#v:mesh\n", + "Construct a mesh graph from two lists of vertices. Complexity:\n", + "O(L1 * L2) time, memory and size, where L1 and L2\n", + "are the lengths of the given lists.\n", + "\n", + "
\n",
+       "mesh xs     []   == empty\n",
+       "mesh []     ys   == empty\n",
+       "mesh [x]    [y]  == vertex (x, y)\n",
+       "mesh xs     ys   == box (path xs) (path ys)\n",
+       "mesh [1..3] \"ab\" == edges [ ((1,'a'),(1,'b')), ((1,'a'),(2,'a')), ((1,'b'),(2,'b')), ((2,'a'),(2,'b'))\n",
+       ", ((2,'a'),(3,'a')), ((2,'b'),(3,'b')), ((3,'a'),(3,'b')) ]\n",
+       "
\n", + "\n", + "torus :: Graph g => [a] -> [b] -> g (a, b)\n", + "URL: https://hackage.haskell.org/package/algebraic-graphs/docs/Algebra-Graph-HigherKinded-Class.html#v:torus\n", + "Construct a torus graph from two lists of vertices. Complexity:\n", + "O(L1 * L2) time, memory and size, where L1 and L2\n", + "are the lengths of the given lists.\n", + "\n", + "
\n",
+       "torus xs    []   == empty\n",
+       "torus []    ys   == empty\n",
+       "torus [x]   [y]  == edge (x,y) (x,y)\n",
+       "torus xs    ys   == box (circuit xs) (circuit ys)\n",
+       "torus [1,2] \"ab\" == edges [ ((1,'a'),(1,'b')), ((1,'a'),(2,'a')), ((1,'b'),(1,'a')), ((1,'b'),(2,'b'))\n",
+       ", ((2,'a'),(1,'a')), ((2,'a'),(2,'b')), ((2,'b'),(1,'b')), ((2,'b'),(2,'a')) ]\n",
+       "
\n", + "\n", + "zipExactMay :: [a] -> [b] -> Maybe [(a, b)]\n", + "URL: https://hackage.haskell.org/package/safe/docs/Safe-Exact.html#v:zipExactMay" ] }, "metadata": {}, @@ -2236,10 +3308,7 @@ }, { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ "If you need a refresher on all of the options, you can just use `:help`:" ] @@ -2247,11 +3316,7 @@ { "cell_type": "code", "execution_count": 26, - "metadata": { - "collapsed": false, - "deletable": true, - "editable": true - }, + "metadata": {}, "outputs": [ { "data": { @@ -2288,10 +3353,7 @@ }, { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ "All of the code you normally put into IHaskell is (like in GHCi) interpreted. However, sometimes you've perfected a function, and now need it to run faster. In that case, you can go ahead and define a module in a single cell. As long as your module has a module header along the lines of `module Name where`, IHaskell will recognize it as a module. It will create the file `A/B.hs`, compile it, and load it. " ] @@ -2299,11 +3361,7 @@ { "cell_type": "code", "execution_count": 27, - "metadata": { - "collapsed": false, - "deletable": true, - "editable": true - }, + "metadata": {}, "outputs": [], "source": [ "-- If your code isn't running fast enough, you can just put it into a module.\n", @@ -2316,10 +3374,7 @@ }, { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ "Note that the module is by default imported unqualified, as though you had typed `import A.B`." ] @@ -2327,11 +3382,7 @@ { "cell_type": "code", "execution_count": 28, - "metadata": { - "collapsed": false, - "deletable": true, - "editable": true - }, + "metadata": {}, "outputs": [ { "data": { @@ -2360,10 +3411,7 @@ }, { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ "Note that since a new module is imported, all previous bound identifiers are now unbound. For instance, we no longer have access to the `f` function from before:" ] @@ -2371,11 +3419,7 @@ { "cell_type": "code", "execution_count": 29, - "metadata": { - "collapsed": false, - "deletable": true, - "editable": true - }, + "metadata": {}, "outputs": [ { "data": { @@ -2477,10 +3521,7 @@ }, { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ "However, if you re-import this module with another import statement, the original implicit import goes away." ] @@ -2488,11 +3529,7 @@ { "cell_type": "code", "execution_count": 30, - "metadata": { - "collapsed": false, - "deletable": true, - "editable": true - }, + "metadata": {}, "outputs": [ { "data": { @@ -2522,10 +3559,7 @@ }, { "cell_type": "markdown", - "metadata": { - "deletable": true, - "editable": true - }, + "metadata": {}, "source": [ "Thanks!\n", "---\n", @@ -2549,7 +3583,8 @@ "codemirror_mode": "ihaskell", "file_extension": ".hs", "name": "haskell", - "version": "8.0.2" + "pygments_lexer": "Haskell", + "version": "8.4.3" }, "latex_envs": { "bibliofile": "biblio.bib", @@ -2570,5 +3605,5 @@ } }, "nbformat": 4, - "nbformat_minor": 0 + "nbformat_minor": 1 }