"If you're looking at this notebook after it's been exported to HTML, you won't be able to see this interactive pane. However, it looks approximately like this:\n",
"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:"
"-- Only takes effect on later cells, so stick it in its own cell.\n",
":opt no-pager"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<style>/*\n",
"Custom IHaskell CSS.\n",
"*/\n",
"\n",
"/* Styles used for the Hoogle display in the pager */\n",
".hoogle-doc {\n",
" display: block;\n",
" padding-bottom: 1.3em;\n",
" padding-left: 0.4em;\n",
"}\n",
".hoogle-code {\n",
" display: block;\n",
" font-family: monospace;\n",
" white-space: pre;\n",
"}\n",
".hoogle-text {\n",
" display: block;\n",
"}\n",
".hoogle-name {\n",
" color: green;\n",
" font-weight: bold;\n",
"}\n",
".hoogle-head {\n",
" font-weight: bold;\n",
"}\n",
".hoogle-sub {\n",
" display: block;\n",
" margin-left: 0.4em;\n",
"}\n",
".hoogle-package {\n",
" font-weight: bold;\n",
" font-style: italic;\n",
"}\n",
".hoogle-module {\n",
" font-weight: bold;\n",
"}\n",
".hoogle-class {\n",
" font-weight: bold;\n",
"}\n",
"\n",
"/* Styles used for basic displays */\n",
".get-type {\n",
" color: green;\n",
" font-weight: bold;\n",
" font-family: monospace;\n",
" display: block;\n",
" white-space: pre;\n",
"}\n",
"\n",
".show-type {\n",
" color: green;\n",
" font-weight: bold;\n",
" font-family: monospace;\n",
" margin-left: 1em;\n",
"}\n",
"\n",
".mono {\n",
" font-family: monospace;\n",
" display: block;\n",
"}\n",
"\n",
".err-msg {\n",
" color: red;\n",
" font-style: italic;\n",
" font-family: monospace;\n",
" white-space: pre;\n",
" display: block;\n",
"}\n",
"\n",
"#unshowable {\n",
" color: red;\n",
" font-weight: bold;\n",
"}\n",
"\n",
".err-msg.in.collapse {\n",
" padding-top: 0.7em;\n",
"}\n",
"\n",
"/* Code that will get highlighted before it is highlighted */\n",
".highlight-code {\n",
" white-space: pre;\n",
" font-family: monospace;\n",
"}\n",
"\n",
"/* Hlint styles */\n",
".suggestion-warning { \n",
" font-weight: bold;\n",
" color: rgb(200, 130, 0);\n",
"}\n",
".suggestion-error { \n",
" font-weight: bold;\n",
" color: red;\n",
"}\n",
".suggestion-name {\n",
" font-weight: bold;\n",
"}\n",
"</style><div style='background: rgb(247, 247, 247);'><form><textarea id='code'>class (Real a, Enum a) => Integral a where\n",
" quot :: a -> a -> a\n",
" rem :: a -> a -> a\n",
" div :: a -> a -> a\n",
" mod :: a -> a -> a\n",
" quotRem :: a -> a -> (a, a)\n",
" divMod :: a -> a -> (a, a)\n",
" toInteger :: a -> Integer\n",
" \t-- Defined in ‘GHC.Real’\n",
"instance Integral a => Integral (Tagged s a) -- Defined in ‘Data.Tagged’\n",
"instance Integral Integer -- Defined in ‘GHC.Real’\n",
"instance Integral Int -- Defined in ‘GHC.Real’</textarea></form></div><script>CodeMirror.fromTextArea(document.getElementById('code'), {mode: 'haskell', readOnly: 'nocursor'});</script>\n"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
":info Integral"
]
]
},
},
{
{
...
@@ -550,7 +693,7 @@
...
@@ -550,7 +693,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 12,
"execution_count": 13,
"metadata": {
"metadata": {
"collapsed": false
"collapsed": false
},
},
...
@@ -592,7 +735,7 @@
...
@@ -592,7 +735,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 13,
"execution_count": 14,
"metadata": {
"metadata": {
"collapsed": false
"collapsed": false
},
},
...
@@ -614,7 +757,7 @@
...
@@ -614,7 +757,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 14,
"execution_count": 15,
"metadata": {
"metadata": {
"collapsed": false
"collapsed": false
},
},
...
@@ -644,7 +787,7 @@
...
@@ -644,7 +787,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 15,
"execution_count": 16,
"metadata": {
"metadata": {
"collapsed": false
"collapsed": false
},
},
...
@@ -986,7 +1129,7 @@
...
@@ -986,7 +1129,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 16,
"execution_count": 17,
"metadata": {
"metadata": {
"collapsed": false
"collapsed": false
},
},
...
@@ -1306,7 +1449,13 @@
...
@@ -1306,7 +1449,13 @@
".suggestion-name {\n",
".suggestion-name {\n",
" font-weight: bold;\n",
" font-weight: bold;\n",
"}\n",
"}\n",
"</style><span class='err-msg'>No instance for (Show NoShow) arising from a use of ‘print’<br/>In a stmt of an interactive GHCi command: print it</span>"
"</style><div class='collapse-group'><span class='btn btn-default' href='#' id='unshowable'>Unshowable:<span class='show-type'>NoShow</span></span><span class='err-msg collapse'>No instance for (Show NoShow) arising from a use of ‘print’<br/>In a stmt of an interactive GHCi command: print it</span></div><script>$('#unshowable').on('click', function(e) {\n",
" e.preventDefault();\n",
" var $this = $(this);\n",
" var $collapse = $this.closest('.collapse-group').find('.err-msg');\n",
" $collapse.collapse('toggle');\n",
"});\n",
"</script>"
],
],
"text/plain": [
"text/plain": [
"No instance for (Show NoShow) arising from a use of ‘print’\n",
"No instance for (Show NoShow) arising from a use of ‘print’\n",
...
@@ -1338,7 +1487,7 @@
...
@@ -1338,7 +1487,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 17,
"execution_count": 18,
"metadata": {
"metadata": {
"collapsed": false
"collapsed": false
},
},
...
@@ -1711,7 +1860,7 @@
...
@@ -1711,7 +1860,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 18,
"execution_count": 19,
"metadata": {
"metadata": {
"collapsed": false
"collapsed": false
},
},
...
@@ -1982,7 +2131,7 @@
...
@@ -1982,7 +2131,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 19,
"execution_count": 20,
"metadata": {
"metadata": {
"collapsed": false
"collapsed": false
},
},
...
@@ -2032,7 +2181,7 @@
...
@@ -2032,7 +2181,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 20,
"execution_count": 21,
"metadata": {
"metadata": {
"collapsed": false
"collapsed": false
},
},
...
@@ -2087,7 +2236,7 @@
...
@@ -2087,7 +2236,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 21,
"execution_count": 22,
"metadata": {
"metadata": {
"collapsed": false
"collapsed": false
},
},
...
@@ -2122,7 +2271,7 @@
...
@@ -2122,7 +2271,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 22,
"execution_count": 23,
"metadata": {
"metadata": {
"collapsed": false
"collapsed": false
},
},
...
@@ -2138,6 +2287,11 @@
...
@@ -2138,6 +2287,11 @@
}
}
],
],
"source": [
"source": [
"-- This import is unnecessary, but ensures that\n",
"-- you actually have the magic library installed. Otherwise,\n",
"-- the bytestring will get displayed as a large string!\n",
"/* Styles used for the Hoogle display in the pager */\n",
".hoogle-doc {\n",
" display: block;\n",
" padding-bottom: 1.3em;\n",
" padding-left: 0.4em;\n",
"}\n",
".hoogle-code {\n",
" display: block;\n",
" font-family: monospace;\n",
" white-space: pre;\n",
"}\n",
".hoogle-text {\n",
" display: block;\n",
"}\n",
".hoogle-name {\n",
" color: green;\n",
" font-weight: bold;\n",
"}\n",
".hoogle-head {\n",
" font-weight: bold;\n",
"}\n",
".hoogle-sub {\n",
" display: block;\n",
" margin-left: 0.4em;\n",
"}\n",
".hoogle-package {\n",
" font-weight: bold;\n",
" font-style: italic;\n",
"}\n",
".hoogle-module {\n",
" font-weight: bold;\n",
"}\n",
".hoogle-class {\n",
" font-weight: bold;\n",
"}\n",
"\n",
"/* Styles used for basic displays */\n",
".get-type {\n",
" color: green;\n",
" font-weight: bold;\n",
" font-family: monospace;\n",
" display: block;\n",
" white-space: pre;\n",
"}\n",
"\n",
".show-type {\n",
" color: green;\n",
" font-weight: bold;\n",
" font-family: monospace;\n",
" margin-left: 1em;\n",
"}\n",
"\n",
".mono {\n",
" font-family: monospace;\n",
" display: block;\n",
"}\n",
"\n",
".err-msg {\n",
" color: red;\n",
" font-style: italic;\n",
" font-family: monospace;\n",
" white-space: pre;\n",
" display: block;\n",
"}\n",
"\n",
"#unshowable {\n",
" color: red;\n",
" font-weight: bold;\n",
"}\n",
"\n",
".err-msg.in.collapse {\n",
" padding-top: 0.7em;\n",
"}\n",
"\n",
"/* Code that will get highlighted before it is highlighted */\n",
".highlight-code {\n",
" white-space: pre;\n",
" font-family: monospace;\n",
"}\n",
"\n",
"/* Hlint styles */\n",
".suggestion-warning { \n",
" font-weight: bold;\n",
" color: rgb(200, 130, 0);\n",
"}\n",
".suggestion-error { \n",
" font-weight: bold;\n",
" color: red;\n",
"}\n",
".suggestion-name {\n",
" font-weight: bold;\n",
"}\n",
"</style><span class='hoogle-name'><a target='_blank' href='http://hackage.haskell.org/packages/archive/base/latest/doc/html/Control-Monad.html#v:filterM'>filterM</a> ∷ Monad m ⇒ (a → m Bool) → [a] → m [a]</span><span class='hoogle-sub'>(<span class='hoogle-head'>package</span> <span class='hoogle-package'>base</span>, <span class='hoogle-head'>module</span> <span class='hoogle-module'>Control.Monad</span>)</span><div class='hoogle-doc'><div class='hoogle-text'>This generalizes the list-based filter function. \n",
"</div>\n",
"</div>\n"
]
},
"metadata": {},
"output_type": "display_data"
}
}
],
],
"source": [
"source": [
...
@@ -2399,29 +2660,121 @@
...
@@ -2399,29 +2660,121 @@
"hidden": false
"hidden": false
},
},
"source": [
"source": [
"Like with `:info`, the Hoogle directives use the IPython documentation pager to show you their output. You can press Escape to dismiss the pager. If you're reading this in it's HTML form, the output looks like this:\n",
"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."
"The pager will show you documentation for things that could have that type signature or a similar one. It automatically formats inline Haskell code and hyperlinks the identifiers to their respective Haddock documentations:\n",