mirror of
https://github.com/IHaskell/IHaskell.git
synced 2025-04-14 10:26:07 +00:00
Change default class to "CodeMirror cm-s-jupyter cm-s-ipython" and update acceptance test
cm-s-ipython for coloring in Jupyter Notebook cm-s-jupyter for coloring in Jupyter Lab CodeMirror for monospace font in both
This commit is contained in:
parent
37ee74aeba
commit
1dc18fadd3
@ -140,8 +140,8 @@ kernelCodeMirrorFlag = flagReq ["codemirror"] (store CodeMirror) "<codemirror>"
|
||||
"Specify codemirror mode that is used for syntax highlighting (default: ihaskell)."
|
||||
|
||||
kernelHtmlCodeWrapperClassFlag :: Flag Args
|
||||
kernelHtmlCodeWrapperClassFlag = flagReq ["html-code-wrapper-class"] (store HtmlCodeWrapperClass) "cm-s-jupyter"
|
||||
"Specify class name for wrapper div around HTML output (default: cm-s-jupyter)"
|
||||
kernelHtmlCodeWrapperClassFlag = flagReq ["html-code-wrapper-class"] (store HtmlCodeWrapperClass) "CodeMirror cm-s-jupyter cm-s-ipython"
|
||||
"Specify class name for wrapper div around HTML output (default: 'CodeMirror cm-s-jupyter cm-s-ipython')"
|
||||
|
||||
kernelHtmlCodeTokenPrefixFlag :: Flag Args
|
||||
kernelHtmlCodeTokenPrefixFlag = flagReq ["html-code-token-prefix"] (store HtmlCodeTokenPrefix) "cm-"
|
||||
|
@ -57,7 +57,7 @@ defaultKernelSpecOptions = KernelSpecOptions
|
||||
-- multithreading on two processors.
|
||||
, kernelSpecDebug = False
|
||||
, kernelSpecCodeMirror = "ihaskell"
|
||||
, kernelSpecHtmlCodeWrapperClass = Just "cm-s-jupyter"
|
||||
, kernelSpecHtmlCodeWrapperClass = Just "CodeMirror cm-s-jupyter cm-s-ipython"
|
||||
, kernelSpecHtmlCodeTokenPrefix = "cm-"
|
||||
, kernelSpecConfFile = defaultConfFile
|
||||
, kernelSpecInstallPrefix = Nothing
|
||||
|
@ -205,7 +205,7 @@ defaultKernelState = KernelState
|
||||
, openComms = mempty
|
||||
, kernelDebug = False
|
||||
, supportLibrariesAvailable = True
|
||||
, htmlCodeWrapperClass = Just "cm-s-jupyter"
|
||||
, htmlCodeWrapperClass = Just "CodeMirror cm-s-jupyter cm-s-ipython"
|
||||
, htmlCodeTokenPrefix = "cm-"
|
||||
}
|
||||
|
||||
|
@ -187,7 +187,7 @@ testEval =
|
||||
(displays, output) <- eval ":in String"
|
||||
displays `shouldBe` [ManyDisplay [Display [
|
||||
DisplayData PlainText "type String :: *\ntype String = [Char]\n \t-- Defined in \8216GHC.Base\8217"
|
||||
, DisplayData MimeHtml "<div class=\"code cm-s-jupyter\"><span class=\"cm-keyword\">type</span><span class=\"cm-space\"> </span><span class=\"cm-variable-2\">String</span><span class=\"cm-space\"> </span><span class=\"cm-atom\">::</span><span class=\"cm-space\"> </span><span class=\"cm-atom\">*</span><span class=\"cm-space\"><br /></span>\n<span class=\"cm-keyword\">type</span><span class=\"cm-space\"> </span><span class=\"cm-variable-2\">String</span><span class=\"cm-space\"> </span><span class=\"cm-atom\">=</span><span class=\"cm-space\"> </span><span class=\"cm-atom\">[</span><span class=\"cm-variable-2\">Char</span><span class=\"cm-atom\">]</span><span class=\"cm-space\"><br /> \t</span><span class=\"cm-comment\">-- Defined in \8216GHC.Base\8217</span><span class=\"cm-space\"><br /></span></div>"
|
||||
, DisplayData MimeHtml "<div class=\"code CodeMirror cm-s-jupyter cm-s-ipython\"><span class=\"cm-keyword\">type</span><span class=\"cm-space\"> </span><span class=\"cm-variable-2\">String</span><span class=\"cm-space\"> </span><span class=\"cm-atom\">::</span><span class=\"cm-space\"> </span><span class=\"cm-atom\">*</span><span class=\"cm-space\"><br /></span>\n<span class=\"cm-keyword\">type</span><span class=\"cm-space\"> </span><span class=\"cm-variable-2\">String</span><span class=\"cm-space\"> </span><span class=\"cm-atom\">=</span><span class=\"cm-space\"> </span><span class=\"cm-atom\">[</span><span class=\"cm-variable-2\">Char</span><span class=\"cm-atom\">]</span><span class=\"cm-space\"><br /> \t</span><span class=\"cm-comment\">-- Defined in \8216GHC.Base\8217</span><span class=\"cm-space\"><br /></span></div>"
|
||||
]]]
|
||||
|
||||
#else
|
||||
|
@ -284,6 +284,7 @@
|
||||
".hoogle-class {\n",
|
||||
"font-weight: bold;\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
".get-type {\n",
|
||||
"color: green;\n",
|
||||
"font-weight: bold;\n",
|
||||
@ -315,10 +316,12 @@
|
||||
".err-msg.in.collapse {\n",
|
||||
"padding-top: 0.7em;\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
".highlight-code {\n",
|
||||
"white-space: pre;\n",
|
||||
"font-family: monospace;\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
".suggestion-warning { \n",
|
||||
"font-weight: bold;\n",
|
||||
"color: rgb(200, 130, 0);\n",
|
||||
@ -330,10 +333,11 @@
|
||||
".suggestion-name {\n",
|
||||
"font-weight: bold;\n",
|
||||
"}\n",
|
||||
"</style><span class='get-type'>3 + 3 :: forall a. Num a => a</span>"
|
||||
"\n",
|
||||
"</style><span class='get-type'>3 + 3 :: forall {a}. Num a => a</span>"
|
||||
],
|
||||
"text/plain": [
|
||||
"3 + 3 :: forall a. Num a => a"
|
||||
"3 + 3 :: forall {a}. Num a => a"
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
@ -355,15 +359,6 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 10,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
":opt no-pager"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 11,
|
||||
"metadata": {
|
||||
"tags": []
|
||||
},
|
||||
@ -371,92 +366,11 @@
|
||||
{
|
||||
"data": {
|
||||
"text/html": [
|
||||
"<style>/* 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",
|
||||
".get-type {\n",
|
||||
"color: green;\n",
|
||||
"font-weight: bold;\n",
|
||||
"font-family: monospace;\n",
|
||||
"display: block;\n",
|
||||
"white-space: pre-wrap;\n",
|
||||
"}\n",
|
||||
".show-type {\n",
|
||||
"color: green;\n",
|
||||
"font-weight: bold;\n",
|
||||
"font-family: monospace;\n",
|
||||
"margin-left: 1em;\n",
|
||||
"}\n",
|
||||
".mono {\n",
|
||||
"font-family: monospace;\n",
|
||||
"display: block;\n",
|
||||
"}\n",
|
||||
".err-msg {\n",
|
||||
"color: red;\n",
|
||||
"font-style: italic;\n",
|
||||
"font-family: monospace;\n",
|
||||
"white-space: pre;\n",
|
||||
"display: block;\n",
|
||||
"}\n",
|
||||
"#unshowable {\n",
|
||||
"color: red;\n",
|
||||
"font-weight: bold;\n",
|
||||
"}\n",
|
||||
".err-msg.in.collapse {\n",
|
||||
"padding-top: 0.7em;\n",
|
||||
"}\n",
|
||||
".highlight-code {\n",
|
||||
"white-space: pre;\n",
|
||||
"font-family: monospace;\n",
|
||||
"}\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 class=\"code cm-s-jupyter\"><span class=\"cm-keyword\">type</span><span class=\"cm-space\"> </span><span class=\"cm-variable-2\">Integral</span><span class=\"cm-space\"> </span><span class=\"cm-atom\">::</span><span class=\"cm-space\"> </span><span class=\"cm-atom\">*</span><span class=\"cm-space\"> </span><span class=\"cm-atom\">-></span><span class=\"cm-space\"> </span><span class=\"cm-variable-2\">Constraint</span><span class=\"cm-space\"><br /></span>\n",
|
||||
"<div class=\"code CodeMirror cm-s-jupyter cm-s-ipython\"><span class=\"cm-keyword\">type</span><span class=\"cm-space\"> </span><span class=\"cm-variable-2\">Integral</span><span class=\"cm-space\"> </span><span class=\"cm-atom\">::</span><span class=\"cm-space\"> </span><span class=\"cm-atom\">*</span><span class=\"cm-space\"> </span><span class=\"cm-atom\">-></span><span class=\"cm-space\"> </span><span class=\"cm-variable-2\">Constraint</span><span class=\"cm-space\"><br /></span>\n",
|
||||
"<span class=\"cm-keyword\">class</span><span class=\"cm-space\"> </span><span class=\"cm-atom\">(</span><span class=\"cm-variable-2\">Real</span><span class=\"cm-space\"> </span><span class=\"cm-variable\">a</span><span class=\"cm-atom\">,</span><span class=\"cm-space\"> </span><span class=\"cm-variable-2\">Enum</span><span class=\"cm-space\"> </span><span class=\"cm-variable\">a</span><span class=\"cm-atom\">)</span><span class=\"cm-space\"> </span><span class=\"cm-atom\">=></span><span class=\"cm-space\"> </span><span class=\"cm-variable-2\">Integral</span><span class=\"cm-space\"> </span><span class=\"cm-variable\">a</span><span class=\"cm-space\"> </span><span class=\"cm-keyword\">where</span><span class=\"cm-space\"><br /> </span><span class=\"cm-variable\">quot</span><span class=\"cm-space\"> </span><span class=\"cm-atom\">::</span><span class=\"cm-space\"> </span><span class=\"cm-variable\">a</span><span class=\"cm-space\"> </span><span class=\"cm-atom\">-></span><span class=\"cm-space\"> </span><span class=\"cm-variable\">a</span><span class=\"cm-space\"> </span><span class=\"cm-atom\">-></span><span class=\"cm-space\"> </span><span class=\"cm-variable\">a</span><span class=\"cm-space\"><br /> </span><span class=\"cm-variable\">rem</span><span class=\"cm-space\"> </span><span class=\"cm-atom\">::</span><span class=\"cm-space\"> </span><span class=\"cm-variable\">a</span><span class=\"cm-space\"> </span><span class=\"cm-atom\">-></span><span class=\"cm-space\"> </span><span class=\"cm-variable\">a</span><span class=\"cm-space\"> </span><span class=\"cm-atom\">-></span><span class=\"cm-space\"> </span><span class=\"cm-variable\">a</span><span class=\"cm-space\"><br /> </span><span class=\"cm-variable\">div</span><span class=\"cm-space\"> </span><span class=\"cm-atom\">::</span><span class=\"cm-space\"> </span><span class=\"cm-variable\">a</span><span class=\"cm-space\"> </span><span class=\"cm-atom\">-></span><span class=\"cm-space\"> </span><span class=\"cm-variable\">a</span><span class=\"cm-space\"> </span><span class=\"cm-atom\">-></span><span class=\"cm-space\"> </span><span class=\"cm-variable\">a</span><span class=\"cm-space\"><br /> </span><span class=\"cm-variable\">mod</span><span class=\"cm-space\"> </span><span class=\"cm-atom\">::</span><span class=\"cm-space\"> </span><span class=\"cm-variable\">a</span><span class=\"cm-space\"> </span><span class=\"cm-atom\">-></span><span class=\"cm-space\"> </span><span class=\"cm-variable\">a</span><span class=\"cm-space\"> </span><span class=\"cm-atom\">-></span><span class=\"cm-space\"> </span><span class=\"cm-variable\">a</span><span class=\"cm-space\"><br /> </span><span class=\"cm-variable\">quotRem</span><span class=\"cm-space\"> </span><span class=\"cm-atom\">::</span><span class=\"cm-space\"> </span><span class=\"cm-variable\">a</span><span class=\"cm-space\"> </span><span class=\"cm-atom\">-></span><span class=\"cm-space\"> </span><span class=\"cm-variable\">a</span><span class=\"cm-space\"> </span><span class=\"cm-atom\">-></span><span class=\"cm-space\"> </span><span class=\"cm-atom\">(</span><span class=\"cm-variable\">a</span><span class=\"cm-atom\">,</span><span class=\"cm-space\"> </span><span class=\"cm-variable\">a</span><span class=\"cm-atom\">)</span><span class=\"cm-space\"><br /> </span><span class=\"cm-variable\">divMod</span><span class=\"cm-space\"> </span><span class=\"cm-atom\">::</span><span class=\"cm-space\"> </span><span class=\"cm-variable\">a</span><span class=\"cm-space\"> </span><span class=\"cm-atom\">-></span><span class=\"cm-space\"> </span><span class=\"cm-variable\">a</span><span class=\"cm-space\"> </span><span class=\"cm-atom\">-></span><span class=\"cm-space\"> </span><span class=\"cm-atom\">(</span><span class=\"cm-variable\">a</span><span class=\"cm-atom\">,</span><span class=\"cm-space\"> </span><span class=\"cm-variable\">a</span><span class=\"cm-atom\">)</span><span class=\"cm-space\"><br /> </span><span class=\"cm-variable\">toInteger</span><span class=\"cm-space\"> </span><span class=\"cm-atom\">::</span><span class=\"cm-space\"> </span><span class=\"cm-variable\">a</span><span class=\"cm-space\"> </span><span class=\"cm-atom\">-></span><span class=\"cm-space\"> </span><span class=\"cm-variable-2\">Integer</span><span class=\"cm-space\"><br /> </span><span class=\"cm-meta\">{-# MINIMAL</span><span class=\"cm-space\"> </span><span class=\"cm-variable\">quotRem</span><span class=\"cm-atom\">,</span><span class=\"cm-space\"> </span><span class=\"cm-variable\">toInteger</span><span class=\"cm-space\"> </span><span class=\"cm-meta\">#-}</span><span class=\"cm-space\"><br /> \t</span><span class=\"cm-comment\">-- Defined in ‘GHC.Real’</span><span class=\"cm-space\"><br /></span>\n",
|
||||
"<span class=\"cm-keyword\">instance</span><span class=\"cm-space\"> </span><span class=\"cm-variable-2\">Integral</span><span class=\"cm-space\"> </span><span class=\"cm-variable-2\">Word</span><span class=\"cm-space\"> </span><span class=\"cm-comment\">-- Defined in ‘GHC.Real’</span><span class=\"cm-space\"><br /></span>\n",
|
||||
"<span class=\"cm-keyword\">instance</span><span class=\"cm-space\"> </span><span class=\"cm-variable-2\">Integral</span><span class=\"cm-space\"> </span><span class=\"cm-variable-2\">Int</span><span class=\"cm-space\"> </span><span class=\"cm-comment\">-- Defined in ‘GHC.Real’</span><span class=\"cm-space\"><br /></span>\n",
|
||||
"<span class=\"cm-keyword\">instance</span><span class=\"cm-space\"> </span><span class=\"cm-variable-2\">Integral</span><span class=\"cm-space\"> </span><span class=\"cm-variable-2\">Integer</span><span class=\"cm-space\"> </span><span class=\"cm-comment\">-- Defined in ‘GHC.Real’</span><span class=\"cm-space\"><br /></span>\n",
|
||||
"<span class=\"cm-keyword\">instance</span><span class=\"cm-space\"> </span><span class=\"cm-variable-2\">Integral</span><span class=\"cm-space\"> </span><span class=\"cm-variable-2\">Int</span><span class=\"cm-space\"> </span><span class=\"cm-comment\">-- Defined in ‘GHC.Real’</span><span class=\"cm-space\"><br /></span></div>"
|
||||
"<span class=\"cm-keyword\">instance</span><span class=\"cm-space\"> </span><span class=\"cm-variable-2\">Integral</span><span class=\"cm-space\"> </span><span class=\"cm-variable-2\">Word</span><span class=\"cm-space\"> </span><span class=\"cm-comment\">-- Defined in ‘GHC.Real’</span><span class=\"cm-space\"><br /></span></div>"
|
||||
],
|
||||
"text/plain": [
|
||||
"type Integral :: * -> Constraint\n",
|
||||
@ -470,9 +384,9 @@
|
||||
" toInteger :: a -> Integer\n",
|
||||
" {-# MINIMAL quotRem, toInteger #-}\n",
|
||||
" \t-- Defined in ‘GHC.Real’\n",
|
||||
"instance Integral Word -- Defined in ‘GHC.Real’\n",
|
||||
"instance Integral Int -- Defined in ‘GHC.Real’\n",
|
||||
"instance Integral Integer -- Defined in ‘GHC.Real’\n",
|
||||
"instance Integral Int -- Defined in ‘GHC.Real’"
|
||||
"instance Integral Word -- Defined in ‘GHC.Real’"
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
@ -491,6 +405,66 @@
|
||||
"## Test `IHaskellDisplay`"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 11,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/html": [
|
||||
"<div style='font-weight: bold; color:red'>Look!</div>"
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"text/html": [
|
||||
"<div style='font-weight: bold; color:green'>Look!</div>"
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"text/html": [
|
||||
"<div style='font-weight: bold; color:blue'>Look!</div>"
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"import IHaskell.Display\n",
|
||||
"\n",
|
||||
"data Color = Red | Green | Blue\n",
|
||||
"\n",
|
||||
"instance IHaskellDisplay Color where\n",
|
||||
" display color = return $ Display [html code]\n",
|
||||
" where\n",
|
||||
" code = concat [\"<div style='font-weight: bold; color:\"\n",
|
||||
" , css color\n",
|
||||
" , \"'>Look!</div>\"]\n",
|
||||
" css Red = \"red\"\n",
|
||||
" css Blue = \"blue\"\n",
|
||||
" css Green = \"green\"\n",
|
||||
"\n",
|
||||
"Red\n",
|
||||
"Green\n",
|
||||
"Blue"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## Test `hlint` "
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 12,
|
||||
@ -534,6 +508,7 @@
|
||||
".hoogle-class {\n",
|
||||
"font-weight: bold;\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
".get-type {\n",
|
||||
"color: green;\n",
|
||||
"font-weight: bold;\n",
|
||||
@ -565,10 +540,12 @@
|
||||
".err-msg.in.collapse {\n",
|
||||
"padding-top: 0.7em;\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
".highlight-code {\n",
|
||||
"white-space: pre;\n",
|
||||
"font-family: monospace;\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
".suggestion-warning { \n",
|
||||
"font-weight: bold;\n",
|
||||
"color: rgb(200, 130, 0);\n",
|
||||
@ -580,309 +557,7 @@
|
||||
".suggestion-name {\n",
|
||||
"font-weight: bold;\n",
|
||||
"}\n",
|
||||
"</style><div style='font-weight: bold; color:red'>Look!</div>"
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"text/html": [
|
||||
"<style>/* 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",
|
||||
".get-type {\n",
|
||||
"color: green;\n",
|
||||
"font-weight: bold;\n",
|
||||
"font-family: monospace;\n",
|
||||
"display: block;\n",
|
||||
"white-space: pre-wrap;\n",
|
||||
"}\n",
|
||||
".show-type {\n",
|
||||
"color: green;\n",
|
||||
"font-weight: bold;\n",
|
||||
"font-family: monospace;\n",
|
||||
"margin-left: 1em;\n",
|
||||
"}\n",
|
||||
".mono {\n",
|
||||
"font-family: monospace;\n",
|
||||
"display: block;\n",
|
||||
"}\n",
|
||||
".err-msg {\n",
|
||||
"color: red;\n",
|
||||
"font-style: italic;\n",
|
||||
"font-family: monospace;\n",
|
||||
"white-space: pre;\n",
|
||||
"display: block;\n",
|
||||
"}\n",
|
||||
"#unshowable {\n",
|
||||
"color: red;\n",
|
||||
"font-weight: bold;\n",
|
||||
"}\n",
|
||||
".err-msg.in.collapse {\n",
|
||||
"padding-top: 0.7em;\n",
|
||||
"}\n",
|
||||
".highlight-code {\n",
|
||||
"white-space: pre;\n",
|
||||
"font-family: monospace;\n",
|
||||
"}\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='font-weight: bold; color:green'>Look!</div>"
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"text/html": [
|
||||
"<style>/* 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",
|
||||
".get-type {\n",
|
||||
"color: green;\n",
|
||||
"font-weight: bold;\n",
|
||||
"font-family: monospace;\n",
|
||||
"display: block;\n",
|
||||
"white-space: pre-wrap;\n",
|
||||
"}\n",
|
||||
".show-type {\n",
|
||||
"color: green;\n",
|
||||
"font-weight: bold;\n",
|
||||
"font-family: monospace;\n",
|
||||
"margin-left: 1em;\n",
|
||||
"}\n",
|
||||
".mono {\n",
|
||||
"font-family: monospace;\n",
|
||||
"display: block;\n",
|
||||
"}\n",
|
||||
".err-msg {\n",
|
||||
"color: red;\n",
|
||||
"font-style: italic;\n",
|
||||
"font-family: monospace;\n",
|
||||
"white-space: pre;\n",
|
||||
"display: block;\n",
|
||||
"}\n",
|
||||
"#unshowable {\n",
|
||||
"color: red;\n",
|
||||
"font-weight: bold;\n",
|
||||
"}\n",
|
||||
".err-msg.in.collapse {\n",
|
||||
"padding-top: 0.7em;\n",
|
||||
"}\n",
|
||||
".highlight-code {\n",
|
||||
"white-space: pre;\n",
|
||||
"font-family: monospace;\n",
|
||||
"}\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='font-weight: bold; color:blue'>Look!</div>"
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"import IHaskell.Display\n",
|
||||
"\n",
|
||||
"data Color = Red | Green | Blue\n",
|
||||
"\n",
|
||||
"instance IHaskellDisplay Color where\n",
|
||||
" display color = return $ Display [html code]\n",
|
||||
" where\n",
|
||||
" code = concat [\"<div style='font-weight: bold; color:\"\n",
|
||||
" , css color\n",
|
||||
" , \"'>Look!</div>\"]\n",
|
||||
" css Red = \"red\"\n",
|
||||
" css Blue = \"blue\"\n",
|
||||
" css Green = \"green\"\n",
|
||||
"\n",
|
||||
"Red\n",
|
||||
"Green\n",
|
||||
"Blue"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## Test `hlint` "
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 13,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/html": [
|
||||
"<style>/* 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",
|
||||
".get-type {\n",
|
||||
"color: green;\n",
|
||||
"font-weight: bold;\n",
|
||||
"font-family: monospace;\n",
|
||||
"display: block;\n",
|
||||
"white-space: pre-wrap;\n",
|
||||
"}\n",
|
||||
".show-type {\n",
|
||||
"color: green;\n",
|
||||
"font-weight: bold;\n",
|
||||
"font-family: monospace;\n",
|
||||
"margin-left: 1em;\n",
|
||||
"}\n",
|
||||
".mono {\n",
|
||||
"font-family: monospace;\n",
|
||||
"display: block;\n",
|
||||
"}\n",
|
||||
".err-msg {\n",
|
||||
"color: red;\n",
|
||||
"font-style: italic;\n",
|
||||
"font-family: monospace;\n",
|
||||
"white-space: pre;\n",
|
||||
"display: block;\n",
|
||||
"}\n",
|
||||
"#unshowable {\n",
|
||||
"color: red;\n",
|
||||
"font-weight: bold;\n",
|
||||
"}\n",
|
||||
".err-msg.in.collapse {\n",
|
||||
"padding-top: 0.7em;\n",
|
||||
"}\n",
|
||||
".highlight-code {\n",
|
||||
"white-space: pre;\n",
|
||||
"font-family: monospace;\n",
|
||||
"}\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",
|
||||
"\n",
|
||||
"</style><div class=\"suggestion-name\" style=\"clear:both;\">Redundant $</div><div class=\"suggestion-row\" style=\"float: left;\"><div class=\"suggestion-warning\">Found:</div><div class=\"highlight-code\" id=\"haskell\">f $ 3</div></div><div class=\"suggestion-row\" style=\"float: left;\"><div class=\"suggestion-warning\">Why Not:</div><div class=\"highlight-code\" id=\"haskell\">f 3</div></div>"
|
||||
],
|
||||
"text/plain": [
|
||||
@ -925,7 +600,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 14,
|
||||
"execution_count": 13,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
@ -971,7 +646,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 15,
|
||||
"execution_count": 14,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
@ -1021,6 +696,7 @@
|
||||
".hoogle-class {\n",
|
||||
"font-weight: bold;\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
".get-type {\n",
|
||||
"color: green;\n",
|
||||
"font-weight: bold;\n",
|
||||
@ -1052,10 +728,12 @@
|
||||
".err-msg.in.collapse {\n",
|
||||
"padding-top: 0.7em;\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
".highlight-code {\n",
|
||||
"white-space: pre;\n",
|
||||
"font-family: monospace;\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
".suggestion-warning { \n",
|
||||
"font-weight: bold;\n",
|
||||
"color: rgb(200, 130, 0);\n",
|
||||
@ -1067,6 +745,7 @@
|
||||
".suggestion-name {\n",
|
||||
"font-weight: bold;\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
"</style><span class='get-type'>x = 'a' : 'b' : 'c' : 'd' : _\n",
|
||||
"</span>"
|
||||
],
|
||||
@ -1095,7 +774,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 16,
|
||||
"execution_count": 15,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@ -1118,7 +797,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 17,
|
||||
"execution_count": 16,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
@ -1157,7 +836,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 18,
|
||||
"execution_count": 17,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
@ -1184,7 +863,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 19,
|
||||
"execution_count": 18,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
@ -1227,7 +906,7 @@
|
||||
"mimetype": "text/x-haskell",
|
||||
"name": "haskell",
|
||||
"pygments_lexer": "Haskell",
|
||||
"version": "9.2.8"
|
||||
"version": "9.4.5"
|
||||
},
|
||||
"latex_envs": {
|
||||
"bibliofile": "biblio.bib",
|
||||
|
Loading…
x
Reference in New Issue
Block a user