mirror of
https://github.com/IHaskell/IHaskell.git
synced 2025-04-14 10:26:07 +00:00
Make ihaskell-widgets extensible
This commit is contained in:
parent
8bfde35b62
commit
cf2f5c04fb
@ -103,7 +103,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 1,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@ -137,9 +137,107 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 2,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"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",
|
||||
"\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",
|
||||
"\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",
|
||||
"}\n",
|
||||
".suggestion-error { \n",
|
||||
"font-weight: bold;\n",
|
||||
"color: red;\n",
|
||||
"}\n",
|
||||
".suggestion-name {\n",
|
||||
"font-weight: bold;\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
"</style><span class='get-type'>setField :: forall f w. (RElemOf f (WidgetFields w), ToKey f, IHaskellWidget (IPythonWidget w), ToPairs (Attr f)) => IPythonWidget w -> FieldType f -> IO ()</span>"
|
||||
],
|
||||
"text/plain": [
|
||||
"setField :: forall f w. (RElemOf f (WidgetFields w), ToKey f, IHaskellWidget (IPythonWidget w), ToPairs (Attr f)) => IPythonWidget w -> FieldType f -> IO ()"
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
":t setField"
|
||||
]
|
||||
@ -148,18 +246,116 @@
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"The `setField` function takes three arguments:\n",
|
||||
"The `setField` function takes three arguments, the first of which is a typelevel argument:\n",
|
||||
"\n",
|
||||
"1. A widget\n",
|
||||
"2. A `Field`\n",
|
||||
"1. A type level `Field`\n",
|
||||
"2. A widget\n",
|
||||
"3. A value for the `Field`"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 3,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"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",
|
||||
"\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",
|
||||
"\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",
|
||||
"}\n",
|
||||
".suggestion-error { \n",
|
||||
"font-weight: bold;\n",
|
||||
"color: red;\n",
|
||||
"}\n",
|
||||
".suggestion-name {\n",
|
||||
"font-weight: bold;\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
"</style><span class='get-type'>getField :: forall f w. RElemOf f (WidgetFields w) => IPythonWidget w -> IO (FieldType f)</span>"
|
||||
],
|
||||
"text/plain": [
|
||||
"getField :: forall f w. RElemOf f (WidgetFields w) => IPythonWidget w -> IO (FieldType f)"
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
":t getField"
|
||||
]
|
||||
@ -168,7 +364,7 @@
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"The `getField` function takes a `Widget` and a `Field` and returns the value of that `Field` for the `Widget`."
|
||||
"The `getField` function takes a type-level `Field` and a `Widget` value and returns the value of that `Field` for the `Widget`."
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -180,9 +376,107 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 4,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"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",
|
||||
"\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",
|
||||
"\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",
|
||||
"}\n",
|
||||
".suggestion-error { \n",
|
||||
"font-weight: bold;\n",
|
||||
"color: red;\n",
|
||||
"}\n",
|
||||
".suggestion-name {\n",
|
||||
"font-weight: bold;\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
"</style><span class='get-type'>properties :: forall w. IPythonWidget w -> IO ()</span>"
|
||||
],
|
||||
"text/plain": [
|
||||
"properties :: forall w. IPythonWidget w -> IO ()"
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
":t properties"
|
||||
]
|
||||
@ -198,9 +492,28 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 5,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"3"
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"\"abc\""
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"-- Showables\n",
|
||||
"1 + 2\n",
|
||||
@ -216,9 +529,107 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 6,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"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",
|
||||
"\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",
|
||||
"\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",
|
||||
"}\n",
|
||||
".suggestion-error { \n",
|
||||
"font-weight: bold;\n",
|
||||
"color: red;\n",
|
||||
"}\n",
|
||||
".suggestion-name {\n",
|
||||
"font-weight: bold;\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
"</style><span class='get-type'>display :: forall a. IHaskellDisplay a => a -> IO Display</span>"
|
||||
],
|
||||
"text/plain": [
|
||||
"display :: forall a. IHaskellDisplay a => a -> IO Display"
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"import IHaskell.Display\n",
|
||||
":t display"
|
||||
@ -246,9 +657,107 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 7,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"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",
|
||||
"\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",
|
||||
"\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",
|
||||
"}\n",
|
||||
".suggestion-error { \n",
|
||||
"font-weight: bold;\n",
|
||||
"color: red;\n",
|
||||
"}\n",
|
||||
".suggestion-name {\n",
|
||||
"font-weight: bold;\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
"</style><span class='get-type'>closeWidget :: forall w. IHaskellWidget w => w -> IO ()</span>"
|
||||
],
|
||||
"text/plain": [
|
||||
"closeWidget :: forall w. IHaskellWidget w => w -> IO ()"
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
":t closeWidget"
|
||||
]
|
||||
@ -271,9 +780,107 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 8,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"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",
|
||||
"\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",
|
||||
"\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",
|
||||
"}\n",
|
||||
".suggestion-error { \n",
|
||||
"font-weight: bold;\n",
|
||||
"color: red;\n",
|
||||
"}\n",
|
||||
".suggestion-name {\n",
|
||||
"font-weight: bold;\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
"</style><span class='get-type'>button :: Button</span>"
|
||||
],
|
||||
"text/plain": [
|
||||
"button :: Button"
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"button <- mkButton -- Construct a Button\n",
|
||||
":t button"
|
||||
@ -288,9 +895,21 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 9,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "5e8125e2-4d0a-4ce4-902d-aad1922ce61b",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
}
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"button -- Display the button"
|
||||
]
|
||||
@ -304,9 +923,36 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 10,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"ViewModule ::: Text\n",
|
||||
"ViewModuleVersion ::: Text\n",
|
||||
"ModelModule ::: Text\n",
|
||||
"ModelModuleVersion ::: Text\n",
|
||||
"ModelName ::: Text\n",
|
||||
"ViewName ::: Text\n",
|
||||
"DOMClasses ::: [Text]\n",
|
||||
"Tabbable ::: Maybe Bool\n",
|
||||
"Tooltip ::: Maybe Text\n",
|
||||
"Layout ::: IPythonWidget LayoutType\n",
|
||||
"DisplayHandler ::: IO ()\n",
|
||||
"Description ::: Text\n",
|
||||
"DescriptionAllowHtml ::: Maybe Bool\n",
|
||||
"Style ::: StyleWidget\n",
|
||||
"Disabled ::: Bool\n",
|
||||
"Icon ::: Text\n",
|
||||
"ButtonStyleField ::: ButtonStyleValue\n",
|
||||
"ClickHandler ::: IO ()"
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"-- The button widget has many properties.\n",
|
||||
"properties button"
|
||||
@ -321,13 +967,13 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 12,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import qualified IHaskell.Display.Widgets.Layout as L\n",
|
||||
"btnLayout <- getField button Layout\n",
|
||||
"setField btnLayout L.Width $ Just \"100%\""
|
||||
"btnLayout <- getField @Layout button\n",
|
||||
"setField @L.Width btnLayout $ Just \"100%\""
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -339,15 +985,15 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 14,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"setField button Description \"Click Me (._.\\\")\"\n",
|
||||
"setField button ButtonStyle SuccessButton\n",
|
||||
"setField btnLayout L.Border $ Just \"ridge 2px\"\n",
|
||||
"setField btnLayout L.Padding $ Just \"10\"\n",
|
||||
"setField btnLayout L.Height $ Just \"7em\""
|
||||
"setField @Description button \"Click Me (._.\\\")\"\n",
|
||||
"setField @ButtonStyleField button SuccessButton\n",
|
||||
"setField @L.BorderTop btnLayout $ Just \"ridge 2px\"\n",
|
||||
"setField @L.Padding btnLayout $ Just \"10\"\n",
|
||||
"setField @L.Height btnLayout $ Just \"7em\""
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -359,11 +1005,23 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 16,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "5e8125e2-4d0a-4ce4-902d-aad1922ce61b",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
}
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"setField button ClickHandler $ putStrLn \"fO_o\"\n",
|
||||
"setField @ClickHandler button $ putStrLn \"fO_o\"\n",
|
||||
"button -- Displaying again for convenience"
|
||||
]
|
||||
},
|
||||
@ -380,11 +1038,11 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 17,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"setField button ClickHandler $ getLine >>= putStrLn"
|
||||
"setField @ClickHandler button $ getLine >>= putStrLn"
|
||||
]
|
||||
}
|
||||
],
|
||||
@ -400,7 +1058,7 @@
|
||||
"mimetype": "text/x-haskell",
|
||||
"name": "haskell",
|
||||
"pygments_lexer": "Haskell",
|
||||
"version": "8.10.4"
|
||||
"version": "9.8.2"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
|
@ -26,104 +26,7 @@
|
||||
"metadata": {
|
||||
"tags": []
|
||||
},
|
||||
"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",
|
||||
"</style><div class=\"suggestion-name\" style=\"clear:both;\">Unused LANGUAGE pragma</div><div class=\"suggestion-row\" style=\"float: left;\"><div class=\"suggestion-warning\">Found:</div><div class=\"highlight-code\" id=\"haskell\">{-# LANGUAGE OverloadedStrings #-}</div></div><div class=\"suggestion-row\" style=\"float: left;\"><div class=\"suggestion-warning\">Why Not:</div><div class=\"highlight-code\" id=\"haskell\"></div></div>"
|
||||
],
|
||||
"text/plain": [
|
||||
"Line 1: Unused LANGUAGE pragma\n",
|
||||
"Found:\n",
|
||||
"{-# LANGUAGE OverloadedStrings #-}\n",
|
||||
"Why not:"
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"{-# LANGUAGE OverloadedStrings #-}\n",
|
||||
"{-# LANGUAGE FlexibleContexts #-}\n",
|
||||
@ -146,11 +49,20 @@
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"jupyter": {
|
||||
"outputs_hidden": false
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": []
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"-- Check box\n",
|
||||
"chk <- mkCheckBox\n",
|
||||
@ -173,6 +85,7 @@
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"jupyter": {
|
||||
"outputs_hidden": false
|
||||
}
|
||||
@ -181,7 +94,7 @@
|
||||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "f86799d9-7bda-4dcb-885a-d65217634d67",
|
||||
"model_id": "75200e34-c1ee-48d6-98b6-61ff755e96e4",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
}
|
||||
@ -192,7 +105,7 @@
|
||||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "71753836-ad8a-495f-9257-280feb66fcf5",
|
||||
"model_id": "db9ce2a9-4a3a-4a0f-b50c-380bae1de262",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
}
|
||||
@ -203,7 +116,7 @@
|
||||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "14bd1aef-8479-43a2-8a10-d6a24561886b",
|
||||
"model_id": "fa3ee396-e46e-4370-a7e0-aa5b521090b7",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
}
|
||||
@ -214,7 +127,7 @@
|
||||
],
|
||||
"source": [
|
||||
"-- Display the widgets\n",
|
||||
"setField tgb Description \"Button\"\n",
|
||||
"setField @Description tgb \"Button\"\n",
|
||||
"chk\n",
|
||||
"tgb\n",
|
||||
"vld"
|
||||
@ -233,9 +146,9 @@
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"b1 <- getField chk BoolValue\n",
|
||||
"b2 <- getField tgb BoolValue\n",
|
||||
"setField vld BoolValue (b1 && b2)"
|
||||
"b1 <- getField @BoolValue chk\n",
|
||||
"b2 <- getField @BoolValue tgb\n",
|
||||
"setField @BoolValue vld (b1 && b2)"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -253,24 +166,25 @@
|
||||
"cell_type": "code",
|
||||
"execution_count": 5,
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"jupyter": {
|
||||
"outputs_hidden": false
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"setField chk Description \"b1\"\n",
|
||||
"setField tgb Description \"b2\"\n",
|
||||
"setField vld Description \"b1 && b2:\"\n",
|
||||
"setField @Description chk \"b1\"\n",
|
||||
"setField @Description tgb \"b2\"\n",
|
||||
"setField @Description vld \"b1 && b2:\"\n",
|
||||
"\n",
|
||||
"ourBoolHandler :: IO ()\n",
|
||||
"ourBoolHandler = do\n",
|
||||
" b1 <- getField chk BoolValue\n",
|
||||
" b2 <- getField tgb BoolValue\n",
|
||||
" setField vld BoolValue (b1 && b2)\n",
|
||||
" b1 <- getField @BoolValue chk\n",
|
||||
" b2 <- getField @BoolValue tgb\n",
|
||||
" setField @BoolValue vld (b1 && b2)\n",
|
||||
"\n",
|
||||
"setField chk ChangeHandler ourBoolHandler\n",
|
||||
"setField tgb ChangeHandler ourBoolHandler"
|
||||
"setField @ChangeHandler chk ourBoolHandler\n",
|
||||
"setField @ChangeHandler tgb ourBoolHandler"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -293,6 +207,7 @@
|
||||
"cell_type": "code",
|
||||
"execution_count": 6,
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"jupyter": {
|
||||
"outputs_hidden": false
|
||||
}
|
||||
@ -315,8 +230,9 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 7,
|
||||
"execution_count": 8,
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"jupyter": {
|
||||
"outputs_hidden": false
|
||||
}
|
||||
@ -326,10 +242,10 @@
|
||||
"sign <- mkCheckBox\n",
|
||||
"bits <- replicateM 7 mkToggleButton\n",
|
||||
"\n",
|
||||
"setField sign Description \"Negative\"\n",
|
||||
"setField @Description sign \"Negative\"\n",
|
||||
"forM_ bits $ \\t -> do\n",
|
||||
" setField t ButtonStyle PrimaryButton\n",
|
||||
" -- setField t BorderRadius 20"
|
||||
" setField @ButtonStyleField t PrimaryButton\n",
|
||||
" -- setField @BorderRadius t 20"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -341,8 +257,9 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 8,
|
||||
"execution_count": 11,
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"jupyter": {
|
||||
"outputs_hidden": false
|
||||
}
|
||||
@ -351,263 +268,13 @@
|
||||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "212247f8-aea0-4eb9-86b9-40b01873e622",
|
||||
"model_id": "cd93f6ed-b871-48cd-b198-d509f1d17cfa",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
}
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
@ -616,20 +283,20 @@
|
||||
"\n",
|
||||
"-- Sub-containers\n",
|
||||
"box1 <- mkBox\n",
|
||||
"setField box1 Children [ChildWidget sign, ChildWidget out]\n",
|
||||
"setField @Children box1 [ChildWidget sign, ChildWidget out]\n",
|
||||
"box2 <- mkBox\n",
|
||||
"setField box2 Children (map ChildWidget $ reverse bits)\n",
|
||||
"setField @Children box2 (map ChildWidget $ reverse bits)\n",
|
||||
"\n",
|
||||
"-- Add widgets to the container\n",
|
||||
"setField box Children (map ChildWidget [box1, box2])\n",
|
||||
"setField @Children box (map ChildWidget [box1, box2])\n",
|
||||
"\n",
|
||||
"-- Add some UI chrome\n",
|
||||
"setField box BoxStyle InfoBox\n",
|
||||
"layout <- getField out Layout\n",
|
||||
"setField layout L.Width $ Just \"100px\"\n",
|
||||
"setField layout L.Height $ Just \"30px\"\n",
|
||||
"setField layout L.Margin $ Just \"10px\"\n",
|
||||
"setField layout L.Border $ Just \"4px groove\"\n",
|
||||
"setField @BoxStyle box InfoBox\n",
|
||||
"layout <- getField @Layout out\n",
|
||||
"setField @L.Width layout $ Just \"100px\"\n",
|
||||
"setField @L.Height layout $ Just \"30px\"\n",
|
||||
"setField @L.Margin layout $ Just \"10px\"\n",
|
||||
"setField @L.BorderTop layout $ Just \"4px groove\"\n",
|
||||
"\n",
|
||||
"-- Display the container\n",
|
||||
"box"
|
||||
@ -644,21 +311,14 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 9,
|
||||
"execution_count": 12,
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"jupyter": {
|
||||
"outputs_hidden": false
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": []
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import Control.Arrow (first, second)\n",
|
||||
"\n",
|
||||
@ -670,21 +330,21 @@
|
||||
"refresh (x, b) = \n",
|
||||
" let val = x * if b then (-1) else 1\n",
|
||||
" fmt = \"<div align=\\\"center\\\"><b>%d</b></div>\"\n",
|
||||
" in setField out StringValue (pack $ printf fmt val)\n",
|
||||
" in setField @StringValue out (pack $ printf fmt val)\n",
|
||||
"\n",
|
||||
"setField sign ChangeHandler $ do\n",
|
||||
"setField @ChangeHandler sign $ do\n",
|
||||
" -- Change sign for value\n",
|
||||
" modifyIORef val (second not)\n",
|
||||
" -- Redraw output\n",
|
||||
" readIORef val >>= refresh\n",
|
||||
" \n",
|
||||
"setField out StringValue \"<div align=\\\"center\\\"><b>%d</b></div>\"\n",
|
||||
"setField @StringValue out \"<div align=\\\"center\\\"><b>%d</b></div>\"\n",
|
||||
"\n",
|
||||
"forM_ (zip bits (iterate (*2) 1)) $ \\(t, n) -> do\n",
|
||||
" setField t Description \"0\"\n",
|
||||
" setField t ChangeHandler $ do\n",
|
||||
" f <- getField t BoolValue\n",
|
||||
" setField t Description (if f then \"1\" else \"0\")\n",
|
||||
" setField @Description t \"0\"\n",
|
||||
" setField @ChangeHandler t $ do\n",
|
||||
" f <- getField @BoolValue t\n",
|
||||
" setField @Description t (if f then \"1\" else \"0\")\n",
|
||||
" modifyIORef val (first $ if f then (+n) else (\\x->x-n))\n",
|
||||
" readIORef val >>= refresh"
|
||||
]
|
||||
@ -709,7 +369,7 @@
|
||||
"mimetype": "text/x-haskell",
|
||||
"name": "haskell",
|
||||
"pygments_lexer": "Haskell",
|
||||
"version": "8.10.4"
|
||||
"version": "9.8.2"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
|
@ -23,104 +23,7 @@
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"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",
|
||||
"</style><div class=\"suggestion-name\" style=\"clear:both;\">Unused LANGUAGE pragma</div><div class=\"suggestion-row\" style=\"float: left;\"><div class=\"suggestion-warning\">Found:</div><div class=\"highlight-code\" id=\"haskell\">{-# LANGUAGE OverloadedStrings #-}</div></div><div class=\"suggestion-row\" style=\"float: left;\"><div class=\"suggestion-warning\">Why Not:</div><div class=\"highlight-code\" id=\"haskell\"></div></div>"
|
||||
],
|
||||
"text/plain": [
|
||||
"Line 1: Unused LANGUAGE pragma\n",
|
||||
"Found:\n",
|
||||
"{-# LANGUAGE OverloadedStrings #-}\n",
|
||||
"Why not:"
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"{-# LANGUAGE OverloadedStrings #-}\n",
|
||||
"import IHaskell.Display.Widgets\n",
|
||||
@ -177,6 +80,7 @@
|
||||
".hoogle-class {\n",
|
||||
"font-weight: bold;\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
".get-type {\n",
|
||||
"color: green;\n",
|
||||
"font-weight: bold;\n",
|
||||
@ -208,10 +112,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",
|
||||
@ -223,10 +129,11 @@
|
||||
".suggestion-name {\n",
|
||||
"font-weight: bold;\n",
|
||||
"}\n",
|
||||
"</style><span class='get-type'>ChildWidget :: forall (w :: WidgetType). RecAll Attr (WidgetFields w) ToPairs => IPythonWidget w -> ChildWidget</span>"
|
||||
"\n",
|
||||
"</style><span class='get-type'>ChildWidget :: forall w. RecAll Attr (WidgetFields w) ToPairs => IPythonWidget w -> ChildWidget</span>"
|
||||
],
|
||||
"text/plain": [
|
||||
"ChildWidget :: forall (w :: WidgetType). RecAll Attr (WidgetFields w) ToPairs => IPythonWidget w -> ChildWidget"
|
||||
"ChildWidget :: forall w. RecAll Attr (WidgetFields w) ToPairs => IPythonWidget w -> ChildWidget"
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
@ -248,7 +155,15 @@
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": []
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"-- Create new Boxes and GridBox\n",
|
||||
"box <- mkBox\n",
|
||||
@ -272,7 +187,7 @@
|
||||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "0417bfce-fdb1-4f01-9d03-a470e5aba96e",
|
||||
"model_id": "b283b563-7997-4306-b009-c05ceb7f704e",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
}
|
||||
@ -283,7 +198,7 @@
|
||||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "7477f34f-e4ce-4320-9316-3d542d3a3c08",
|
||||
"model_id": "559f7696-9ac2-4358-94f8-26d22f2814dc",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
}
|
||||
@ -294,7 +209,7 @@
|
||||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "b0876039-5c34-48c7-968f-e8d99811b177",
|
||||
"model_id": "721db87f-08e1-4e1f-8b21-6a6253a9efed",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
}
|
||||
@ -305,7 +220,7 @@
|
||||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "7670dab0-ab1d-4016-a30f-7f0e3a969ebb",
|
||||
"model_id": "9ac8056c-676a-4bee-9ef1-61d012ab7d92",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
}
|
||||
@ -321,19 +236,19 @@
|
||||
"buttons <- replicateM 4 mkButton\n",
|
||||
"\n",
|
||||
"-- We put its index as description\n",
|
||||
"mapM_ (\\(w,i)->setField w Description $ T.pack $ \"Test \" ++ show i) $ zip buttons [1..]\n",
|
||||
"mapM_ (\\(w,i)-> setField @Description w $ T.pack $ \"Test \" ++ show i) $ zip buttons [1..]\n",
|
||||
"\n",
|
||||
"-- Add children widgets to boxes\n",
|
||||
"let children = map ChildWidget buttons\n",
|
||||
"setField box Children children\n",
|
||||
"setField hbox Children children\n",
|
||||
"setField vbox Children children\n",
|
||||
"setField gbox Children children\n",
|
||||
"setField @Children box children\n",
|
||||
"setField @Children hbox children\n",
|
||||
"setField @Children vbox children\n",
|
||||
"setField @Children gbox children\n",
|
||||
"\n",
|
||||
"setField box BoxStyle SuccessBox\n",
|
||||
"setField vbox BoxStyle InfoBox\n",
|
||||
"setField hbox BoxStyle WarningBox\n",
|
||||
"setField gbox BoxStyle DangerBox\n",
|
||||
"setField @BoxStyle box SuccessBox\n",
|
||||
"setField @BoxStyle vbox InfoBox\n",
|
||||
"setField @BoxStyle hbox WarningBox\n",
|
||||
"setField @BoxStyle gbox DangerBox\n",
|
||||
"\n",
|
||||
"-- Display boxes\n",
|
||||
"box\n",
|
||||
@ -363,8 +278,8 @@
|
||||
"source": [
|
||||
"import qualified IHaskell.Display.Widgets.Layout as L\n",
|
||||
"\n",
|
||||
"layout <- getField gbox Layout\n",
|
||||
"setField layout L.GridTemplateColumns $ Just \"repeat(2,1fr)\""
|
||||
"layout <- getField @Layout gbox\n",
|
||||
"setField @L.GridTemplateColumns layout $ Just \"repeat(2,1fr)\""
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -406,7 +321,7 @@
|
||||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "e9cdff5d-1630-4845-a986-de1ac490e55e",
|
||||
"model_id": "68e855e5-4a69-4a8f-a9d4-b354e9d78ea5",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
}
|
||||
@ -417,7 +332,7 @@
|
||||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "36172e5a-879c-4584-a74b-17a5c121517a",
|
||||
"model_id": "82cda4f9-ddb0-475e-b645-4bc4ead4c522",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
}
|
||||
@ -431,10 +346,10 @@
|
||||
"\n",
|
||||
"let children = map ChildWidget buttons'\n",
|
||||
"\n",
|
||||
"setField acc Titles $ map (\\x->T.pack $ \"Button \" ++ show x) [1..5]\n",
|
||||
"getField acc Titles >>= setField tab Titles\n",
|
||||
"setField acc Children children \n",
|
||||
"setField tab Children children\n",
|
||||
"setField @Titles acc $ map (\\x->T.pack $ \"Button \" ++ show x) [1..5]\n",
|
||||
"getField @Titles acc >>= setField @Titles tab\n",
|
||||
"setField @Children acc children \n",
|
||||
"setField @Children tab children\n",
|
||||
"\n",
|
||||
"acc\n",
|
||||
"tab"
|
||||
@ -449,7 +364,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 9,
|
||||
"execution_count": 8,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
@ -472,13 +387,20 @@
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"getField acc SelectedIndex\n",
|
||||
"getField tab SelectedIndex\n",
|
||||
"getField @SelectedIndex acc\n",
|
||||
"getField @SelectedIndex tab\n",
|
||||
"\n",
|
||||
"-- Let's try closing them\n",
|
||||
"setField tab SelectedIndex Nothing\n",
|
||||
"setField acc SelectedIndex Nothing"
|
||||
"setField @SelectedIndex tab Nothing\n",
|
||||
"setField @SelectedIndex acc Nothing"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
@ -493,7 +415,7 @@
|
||||
"mimetype": "text/x-haskell",
|
||||
"name": "haskell",
|
||||
"pygments_lexer": "Haskell",
|
||||
"version": "8.10.4"
|
||||
"version": "9.8.2"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
|
@ -12,14 +12,26 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 1,
|
||||
"id": "1db1ebee-6896-4a92-9a9c-4d0c0e2fef34",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "a8c7a01e-8962-4053-8726-1053e239a887",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
}
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"{-# LANGUAGE OverloadedStrings #-}\n",
|
||||
"controller <- mkController\n",
|
||||
"setField controller Index 0\n",
|
||||
"setField @Index controller 0\n",
|
||||
"controller"
|
||||
]
|
||||
},
|
||||
@ -28,14 +40,55 @@
|
||||
"execution_count": null,
|
||||
"id": "463d9488-8941-4e4a-aa47-83ba2f879368",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"False"
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"text/plain": []
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"0.0"
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"text/plain": []
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"getField controller Connected\n",
|
||||
"getField controller Name\n",
|
||||
"getField controller Timestamp\n",
|
||||
"getField controller Mapping\n",
|
||||
"getField controller Buttons"
|
||||
"getField @Connected controller\n",
|
||||
"getField @Name controller\n",
|
||||
"getField @Timestamp controller\n",
|
||||
"getField @Mapping controller\n",
|
||||
"getField @Buttons controller"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "732903f0-b50b-4714-b63d-65e54ac2c3c1",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
@ -50,7 +103,7 @@
|
||||
"mimetype": "text/x-haskell",
|
||||
"name": "haskell",
|
||||
"pygments_lexer": "Haskell",
|
||||
"version": "8.10.4"
|
||||
"version": "9.8.2"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
|
@ -16,104 +16,7 @@
|
||||
"execution_count": 1,
|
||||
"id": "3643e44d-0220-46be-867e-8e7781fb7bbe",
|
||||
"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",
|
||||
"</style><div class=\"suggestion-name\" style=\"clear:both;\">Unused LANGUAGE pragma</div><div class=\"suggestion-row\" style=\"float: left;\"><div class=\"suggestion-warning\">Found:</div><div class=\"highlight-code\" id=\"haskell\">{-# LANGUAGE OverloadedStrings #-}</div></div><div class=\"suggestion-row\" style=\"float: left;\"><div class=\"suggestion-warning\">Why Not:</div><div class=\"highlight-code\" id=\"haskell\"></div></div>"
|
||||
],
|
||||
"text/plain": [
|
||||
"Line 1: Unused LANGUAGE pragma\n",
|
||||
"Found:\n",
|
||||
"{-# LANGUAGE OverloadedStrings #-}\n",
|
||||
"Why not:"
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"{-# LANGUAGE OverloadedStrings #-}\n",
|
||||
"import IHaskell.Display.Widgets\n",
|
||||
@ -138,7 +41,7 @@
|
||||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "7d321970-3eda-40b4-818f-f468e1942fff",
|
||||
"model_id": "1ede881c-d143-41db-a247-281e2cc0146a",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
}
|
||||
@ -149,7 +52,7 @@
|
||||
],
|
||||
"source": [
|
||||
"button <- mkButton\n",
|
||||
"setField button Description \"Click me!\"\n",
|
||||
"setField @Description button \"Click me!\"\n",
|
||||
"button"
|
||||
]
|
||||
},
|
||||
@ -168,7 +71,7 @@
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"layout <- getField button Layout"
|
||||
"layout <- getField @Layout button"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -197,7 +100,10 @@
|
||||
"LAlignContent ::: Maybe [Char]\n",
|
||||
"LAlignItems ::: Maybe [Char]\n",
|
||||
"LAlignSelf ::: Maybe [Char]\n",
|
||||
"LBorder ::: Maybe [Char]\n",
|
||||
"LBorderBottom ::: Maybe [Char]\n",
|
||||
"LBorderLeft ::: Maybe [Char]\n",
|
||||
"LBorderRight ::: Maybe [Char]\n",
|
||||
"LBorderTop ::: Maybe [Char]\n",
|
||||
"LBottom ::: Maybe [Char]\n",
|
||||
"LDisplay ::: Maybe [Char]\n",
|
||||
"LFlex ::: Maybe [Char]\n",
|
||||
@ -221,10 +127,10 @@
|
||||
"LMaxWidth ::: Maybe [Char]\n",
|
||||
"LMinHeight ::: Maybe [Char]\n",
|
||||
"LMinWidth ::: Maybe [Char]\n",
|
||||
"LObjectFit ::: Maybe [Char]\n",
|
||||
"LObjectPosition ::: Maybe [Char]\n",
|
||||
"LOrder ::: Maybe [Char]\n",
|
||||
"LOverflow ::: Maybe [Char]\n",
|
||||
"LOverflowX ::: Maybe [Char]\n",
|
||||
"LOverflowY ::: Maybe [Char]\n",
|
||||
"LPadding ::: Maybe [Char]\n",
|
||||
"LRight ::: Maybe [Char]\n",
|
||||
"LTop ::: Maybe [Char]\n",
|
||||
@ -245,19 +151,11 @@
|
||||
"execution_count": 5,
|
||||
"id": "ef00e9aa-3f48-42ff-bb45-9f59b09e78e4",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": []
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"setField layout L.Height $ Just \"50px\"\n",
|
||||
"setField layout L.MinWidth $ Just \"70%\"\n",
|
||||
"setField layout L.Padding $ Just \"10px\""
|
||||
"setField @L.Height layout $ Just \"50px\"\n",
|
||||
"setField @L.MinWidth layout $ Just \"70%\"\n",
|
||||
"setField @L.Padding layout $ Just \"10px\""
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -289,7 +187,7 @@
|
||||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "bfe255db-9a90-47da-9032-48440e0a0b18",
|
||||
"model_id": "def956c6-a71a-4aa1-b78a-e65b3cb068d8",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
}
|
||||
@ -361,6 +259,7 @@
|
||||
".hoogle-class {\n",
|
||||
"font-weight: bold;\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
".get-type {\n",
|
||||
"color: green;\n",
|
||||
"font-weight: bold;\n",
|
||||
@ -392,10 +291,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",
|
||||
@ -407,26 +308,20 @@
|
||||
".suggestion-name {\n",
|
||||
"font-weight: bold;\n",
|
||||
"}\n",
|
||||
"</style><span class='get-type'>StyleWidget :: forall (w :: WidgetType). RecAll Attr (WidgetFields w) ToPairs => IPythonWidget w -> StyleWidget</span>"
|
||||
"\n",
|
||||
"</style><span class='get-type'>StyleWidget :: forall w. RecAll Attr (WidgetFields w) ToPairs => IPythonWidget w -> StyleWidget</span>"
|
||||
],
|
||||
"text/plain": [
|
||||
"StyleWidget :: forall (w :: WidgetType). RecAll Attr (WidgetFields w) ToPairs => IPythonWidget w -> StyleWidget"
|
||||
"StyleWidget :: forall w. RecAll Attr (WidgetFields w) ToPairs => IPythonWidget w -> StyleWidget"
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"text/plain": []
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
":t StyleWidget\n",
|
||||
"setField slider Style $ StyleWidget style"
|
||||
"setField @Style slider $ StyleWidget style"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -444,7 +339,7 @@
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"setField slider Description \"This is a long description\""
|
||||
"setField @Description slider \"This is a long description\""
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -462,7 +357,7 @@
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"setField style DescriptionWidth \"14em\""
|
||||
"setField @DescriptionWidth style \"14em\""
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -480,8 +375,8 @@
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"layout <- getField slider Layout\n",
|
||||
"setField layout L.Width $ Just \"30em\""
|
||||
"layout <- getField @Layout slider\n",
|
||||
"setField @L.Width layout $ Just \"30em\""
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -499,7 +394,7 @@
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"setField style HandleColor $ Just \"pink\""
|
||||
"setField @HandleColor style $ Just \"pink\""
|
||||
]
|
||||
}
|
||||
],
|
||||
@ -515,7 +410,7 @@
|
||||
"mimetype": "text/x-haskell",
|
||||
"name": "haskell",
|
||||
"pygments_lexer": "Haskell",
|
||||
"version": "8.10.4"
|
||||
"version": "9.8.2"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
|
@ -2,13 +2,14 @@
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 9,
|
||||
"id": "a0d6ef1e-d8cd-40dc-8928-aa984ea6e788",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"{-# LANGUAGE OverloadedStrings #-}\n",
|
||||
"import IHaskell.Display.Widgets"
|
||||
"{-# LANGUAGE OverloadedStrings, TypeApplications #-}\n",
|
||||
"import IHaskell.Display.Widgets\n",
|
||||
"import Data.Proxy (Proxy(..))"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -29,14 +30,14 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"execution_count": 11,
|
||||
"id": "107c6fc9-c1fd-433d-8719-fa3daea8bc51",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "bfa03a36-8319-4427-bb4e-79aebec8e97c",
|
||||
"model_id": "a27260ed-9dfe-404a-9bcc-6d3da537794f",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
}
|
||||
@ -47,43 +48,13 @@
|
||||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "a37ece31-9918-468e-9e8c-c2451f8cdf4a",
|
||||
"model_id": "183bfddc-f461-482e-8640-564bf8c1c3ad",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
}
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
@ -93,8 +64,8 @@
|
||||
"\n",
|
||||
"-- Creating the link\n",
|
||||
"link <- mkLink\n",
|
||||
"setField link Source (WidgetFieldPair is1 IntValue)\n",
|
||||
"setField link Target (WidgetFieldPair is2 IntValue)\n",
|
||||
"setField @Source link (WidgetFieldPair is1 (Proxy @IntValue))\n",
|
||||
"setField @Target link (WidgetFieldPair is2 (Proxy @IntValue))\n",
|
||||
"\n",
|
||||
"-- Displaying the widget\n",
|
||||
"is1\n",
|
||||
@ -115,14 +86,14 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 4,
|
||||
"execution_count": 12,
|
||||
"id": "f71e323b-ac72-42e5-8823-b768d6f9cb58",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "c4a67b75-819a-460f-9de6-7bf39a3000d9",
|
||||
"model_id": "5455e23a-2c44-4481-ac98-041f45f16bb2",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
}
|
||||
@ -133,283 +104,13 @@
|
||||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "9ac97149-889c-43ee-abb5-0cc006956064",
|
||||
"model_id": "9665b5d8-a36b-4216-9d1e-120c3f24e856",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
}
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
@ -419,8 +120,8 @@
|
||||
"\n",
|
||||
"-- Making a directional link\n",
|
||||
"link <- mkDirectionalLink\n",
|
||||
"setField link Source (WidgetFieldPair fs1 FloatValue)\n",
|
||||
"setField link Target (WidgetFieldPair fi2 IntValue)\n",
|
||||
"setField @Source link (WidgetFieldPair fs1 (Proxy @FloatValue))\n",
|
||||
"setField @Target link (WidgetFieldPair fi2 (Proxy @IntValue))\n",
|
||||
"\n",
|
||||
"-- Displaying the sliders\n",
|
||||
"fs1\n",
|
||||
@ -441,7 +142,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 7,
|
||||
"execution_count": 13,
|
||||
"id": "91ccf115-57b4-4176-b157-0e79c27f4341",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
@ -483,6 +184,7 @@
|
||||
".hoogle-class {\n",
|
||||
"font-weight: bold;\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
".get-type {\n",
|
||||
"color: green;\n",
|
||||
"font-weight: bold;\n",
|
||||
@ -514,10 +216,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",
|
||||
@ -529,6 +233,7 @@
|
||||
".suggestion-name {\n",
|
||||
"font-weight: bold;\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
"</style><span class='get-type'>jsdlink :: WidgetFieldPair -> WidgetFieldPair -> IO DirectionalLink</span>"
|
||||
],
|
||||
"text/plain": [
|
||||
@ -541,7 +246,7 @@
|
||||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "12cf4ada-4fc9-48c1-981e-ab7121aa9efe",
|
||||
"model_id": "0b0885c4-d023-4bba-a41c-7ca0e53a33e7",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
}
|
||||
@ -552,7 +257,7 @@
|
||||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "e11c0f79-775d-4597-9990-7496c00334bb",
|
||||
"model_id": "b21ab860-754e-469d-85fb-d6e820466311",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
}
|
||||
@ -563,48 +268,13 @@
|
||||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "e1690adb-30eb-4cfc-913f-33ad3133aa5b",
|
||||
"model_id": "5d7e4d16-5ba4-4141-9499-72324df2c594",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
}
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
@ -614,13 +284,21 @@
|
||||
"valid <- mkValid\n",
|
||||
"\n",
|
||||
"-- The Link widget cannot be displayed, so we ignore the return value\n",
|
||||
"_ <- jslink (WidgetFieldPair chk BoolValue) (WidgetFieldPair tgb BoolValue)\n",
|
||||
"_ <- jsdlink (WidgetFieldPair chk BoolValue) (WidgetFieldPair valid BoolValue)\n",
|
||||
"_ <- jslink (WidgetFieldPair chk (Proxy @BoolValue)) (WidgetFieldPair tgb (Proxy @BoolValue))\n",
|
||||
"_ <- jsdlink (WidgetFieldPair chk (Proxy @BoolValue)) (WidgetFieldPair valid (Proxy @BoolValue))\n",
|
||||
"\n",
|
||||
"chk\n",
|
||||
"tgb\n",
|
||||
"valid"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "db91a9da-1075-4264-b633-0ab5a51d22f5",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
@ -635,7 +313,7 @@
|
||||
"mimetype": "text/x-haskell",
|
||||
"name": "haskell",
|
||||
"pygments_lexer": "Haskell",
|
||||
"version": "8.10.4"
|
||||
"version": "9.8.2"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
|
@ -13,106 +13,9 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"execution_count": 1,
|
||||
"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",
|
||||
"</style><div class=\"suggestion-name\" style=\"clear:both;\">Unused LANGUAGE pragma</div><div class=\"suggestion-row\" style=\"float: left;\"><div class=\"suggestion-warning\">Found:</div><div class=\"highlight-code\" id=\"haskell\">{-# LANGUAGE OverloadedStrings #-}</div></div><div class=\"suggestion-row\" style=\"float: left;\"><div class=\"suggestion-warning\">Why Not:</div><div class=\"highlight-code\" id=\"haskell\"></div></div>"
|
||||
],
|
||||
"text/plain": [
|
||||
"Line 1: Unused LANGUAGE pragma\n",
|
||||
"Found:\n",
|
||||
"{-# LANGUAGE OverloadedStrings #-}\n",
|
||||
"Why not:"
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"{-# LANGUAGE OverloadedStrings #-}\n",
|
||||
"import IHaskell.Display.Widgets"
|
||||
@ -140,7 +43,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 4,
|
||||
"execution_count": 2,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@ -159,13 +62,13 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 6,
|
||||
"execution_count": 3,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "5e350768-e129-4c3b-afff-31543736957d",
|
||||
"model_id": "0658c23f-7cba-4ab9-b6d6-93fad5648695",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
}
|
||||
@ -177,8 +80,8 @@
|
||||
"source": [
|
||||
"png <- get \"https://imgs.xkcd.com/comics/functional.png\"\n",
|
||||
"img <- mkImage\n",
|
||||
"setField img ImageFormat PNG\n",
|
||||
"setField img BSValue $ JSONByteString png\n",
|
||||
"setField @ImageFormat img PNG\n",
|
||||
"setField @BSValue img $ JSONByteString png\n",
|
||||
"img"
|
||||
]
|
||||
},
|
||||
@ -191,13 +94,13 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 7,
|
||||
"execution_count": 4,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "7cd95391-858f-43ec-b014-bc1fc6e53241",
|
||||
"model_id": "6397a504-b72e-48b4-8fdc-7acec20c18cc",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
}
|
||||
@ -208,8 +111,8 @@
|
||||
],
|
||||
"source": [
|
||||
"imgurl <- mkImage\n",
|
||||
"setField imgurl ImageFormat IURL\n",
|
||||
"setField imgurl BSValue \"https://imgs.xkcd.com/comics/haskell.png\"\n",
|
||||
"setField @ImageFormat imgurl IURL\n",
|
||||
"setField @BSValue imgurl \"https://imgs.xkcd.com/comics/haskell.png\"\n",
|
||||
"imgurl"
|
||||
]
|
||||
},
|
||||
@ -224,13 +127,13 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 10,
|
||||
"execution_count": 6,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "3be8c81c-a522-4e6a-9529-9fe6f3113b85",
|
||||
"model_id": "bdc1ff8b-8a8d-4050-bd1e-fbcf05a874d0",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
}
|
||||
@ -241,8 +144,8 @@
|
||||
],
|
||||
"source": [
|
||||
"video <- mkVideo\n",
|
||||
"mp4 <- get \"http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4\"\n",
|
||||
"setField video BSValue $ JSONByteString mp4\n",
|
||||
"mp4 <- get \"https://download.samplelib.com/mp4/sample-5s.mp4\"\n",
|
||||
"setField @BSValue video $ JSONByteString mp4\n",
|
||||
"video"
|
||||
]
|
||||
},
|
||||
@ -260,12 +163,12 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 11,
|
||||
"execution_count": 8,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"setField video Controls False\n",
|
||||
"setField video Loop False"
|
||||
"setField @Controls video False\n",
|
||||
"setField @Loop video False"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -278,13 +181,13 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 13,
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "7a887e98-b625-46cd-ad74-1b4b3cfd767a",
|
||||
"model_id": "e5aeffaa-f2d7-4abe-914e-e7f67403b01b",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
}
|
||||
@ -295,12 +198,19 @@
|
||||
],
|
||||
"source": [
|
||||
"audio <- mkAudio\n",
|
||||
"setField audio BSValue \"https://file-examples-com.github.io/uploads/2017/11/file_example_MP3_700KB.mp3\"\n",
|
||||
"setField audio AudioFormat AURL\n",
|
||||
"setField audio Loop False\n",
|
||||
"setField audio AutoPlay False\n",
|
||||
"setField @BSValue audio \"https://download.samplelib.com/mp3/sample-12s.mp3\"\n",
|
||||
"setField @AudioFormat audio AURL\n",
|
||||
"setField @Loop audio False\n",
|
||||
"setField @AutoPlay audio False\n",
|
||||
"audio"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
@ -315,7 +225,7 @@
|
||||
"mimetype": "text/x-haskell",
|
||||
"name": "haskell",
|
||||
"pygments_lexer": "Haskell",
|
||||
"version": "8.10.4"
|
||||
"version": "9.8.2"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
|
@ -32,104 +32,7 @@
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"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",
|
||||
"</style><div class=\"suggestion-name\" style=\"clear:both;\">Unused LANGUAGE pragma</div><div class=\"suggestion-row\" style=\"float: left;\"><div class=\"suggestion-warning\">Found:</div><div class=\"highlight-code\" id=\"haskell\">{-# LANGUAGE OverloadedStrings #-}</div></div><div class=\"suggestion-row\" style=\"float: left;\"><div class=\"suggestion-warning\">Why Not:</div><div class=\"highlight-code\" id=\"haskell\"></div></div>"
|
||||
],
|
||||
"text/plain": [
|
||||
"Line 1: Unused LANGUAGE pragma\n",
|
||||
"Found:\n",
|
||||
"{-# LANGUAGE OverloadedStrings #-}\n",
|
||||
"Why not:"
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"{-# LANGUAGE OverloadedStrings #-}\n",
|
||||
"import IHaskell.Display.Widgets"
|
||||
@ -151,7 +54,7 @@
|
||||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "0f03d310-6e35-4635-bff5-1b34d78661e4",
|
||||
"model_id": "ef687ad0-ce95-43f7-8e40-45fd169f5d2b",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
}
|
||||
@ -162,7 +65,7 @@
|
||||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "b0535a35-d10c-4887-9559-167cf2e8ab3c",
|
||||
"model_id": "6f226f08-087f-4d38-8bae-ac7740868d57",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
}
|
||||
@ -210,8 +113,8 @@
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"getField intt IntValue\n",
|
||||
"getField floatt FloatValue"
|
||||
"getField @IntValue intt\n",
|
||||
"getField @FloatValue floatt"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -237,8 +140,8 @@
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"x <- getField intt IntValue\n",
|
||||
"y <- getField floatt FloatValue\n",
|
||||
"x <- getField @IntValue intt\n",
|
||||
"y <- getField @FloatValue floatt\n",
|
||||
"\n",
|
||||
"(fromIntegral x) + y"
|
||||
]
|
||||
@ -256,8 +159,8 @@
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"setField intt StepInt $ Just 5\n",
|
||||
"setField floatt StepFloat $ Just 0.5"
|
||||
"setField @StepInt intt $ Just 5\n",
|
||||
"setField @StepFloat floatt $ Just 0.5"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -275,8 +178,8 @@
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"setField intt IntValue 42\n",
|
||||
"setField floatt FloatValue 3.14"
|
||||
"setField @IntValue intt 42\n",
|
||||
"setField @FloatValue floatt 3.14"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -294,7 +197,7 @@
|
||||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "0f03d310-6e35-4635-bff5-1b34d78661e4",
|
||||
"model_id": "ef687ad0-ce95-43f7-8e40-45fd169f5d2b",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
}
|
||||
@ -305,7 +208,7 @@
|
||||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "b0535a35-d10c-4887-9559-167cf2e8ab3c",
|
||||
"model_id": "6f226f08-087f-4d38-8bae-ac7740868d57",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
}
|
||||
@ -315,8 +218,8 @@
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"setField intt ChangeHandler (getField intt IntValue >>= setField floatt FloatValue . (/2) . fromIntegral)\n",
|
||||
"setField floatt ChangeHandler (getField floatt FloatValue >>= setField intt IntValue . (*2) . round)\n",
|
||||
"setField @ChangeHandler intt (getField @IntValue intt >>= setField @FloatValue floatt . (/2) . fromIntegral)\n",
|
||||
"setField @ChangeHandler floatt (getField @FloatValue floatt >>= setField @IntValue intt . (*2) . round)\n",
|
||||
"\n",
|
||||
"-- Let's display the widgets again so we don't have to scroll up and down\n",
|
||||
"intt\n",
|
||||
@ -340,7 +243,7 @@
|
||||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "653d0c7e-1661-48e2-8844-26aa0bb95bc2",
|
||||
"model_id": "b1af0ae0-8483-418d-9927-d97a520ff23f",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
}
|
||||
@ -351,7 +254,7 @@
|
||||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "d52da821-8234-40fa-87e4-f20ef6975311",
|
||||
"model_id": "c1a5c813-360c-4e1a-891c-291d900382d0",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
}
|
||||
@ -365,13 +268,13 @@
|
||||
"bit <- mkBoundedIntText\n",
|
||||
"bft <- mkBoundedFloatText\n",
|
||||
"\n",
|
||||
"setField bit MaxInt 5\n",
|
||||
"setField bit MinInt (-5)\n",
|
||||
"setField @MaxInt bit 5\n",
|
||||
"setField @MinInt bit (-5)\n",
|
||||
"\n",
|
||||
"setField bft MaxFloat 20\n",
|
||||
"setField bft MinFloat 10\n",
|
||||
"setField bft StepFloat $ Just 0.5\n",
|
||||
"setField bft FloatValue 15\n",
|
||||
"setField @MaxFloat bft 20\n",
|
||||
"setField @MinFloat bft 10\n",
|
||||
"setField @StepFloat bft $ Just 0.5\n",
|
||||
"setField @FloatValue bft 15\n",
|
||||
"\n",
|
||||
"bit\n",
|
||||
"bft"
|
||||
@ -409,10 +312,10 @@
|
||||
"fns <- mkFloatSlider\n",
|
||||
"fls <- mkFloatLogSlider\n",
|
||||
"frs <- mkFloatRangeSlider\n",
|
||||
"setField fns StepFloat $ Just 0.25\n",
|
||||
"setField @StepFloat fns $ Just 0.25\n",
|
||||
"-- We can set the base of the logslider\n",
|
||||
"setField fls BaseFloat 2\n",
|
||||
"setField fls StepFloat $ Just 1"
|
||||
"setField @BaseFloat fls 2\n",
|
||||
"setField @StepFloat fls $ Just 1"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -423,7 +326,7 @@
|
||||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "9ef1b79b-2fbf-421b-a340-085f5c406b96",
|
||||
"model_id": "07045bf2-5181-41fc-8fa9-3cdc292107e0",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
}
|
||||
@ -434,7 +337,7 @@
|
||||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "7a4e0717-fd52-45ab-9fd5-6513b1686d3a",
|
||||
"model_id": "de1fd5a4-0ded-42fe-95bc-49458f2a67da",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
}
|
||||
@ -445,7 +348,7 @@
|
||||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "377be754-1e66-4630-91b6-dbd4878f22df",
|
||||
"model_id": "787ef5b0-bf00-4f1b-8c6d-4efc4a9323b2",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
}
|
||||
@ -456,7 +359,7 @@
|
||||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "358e4973-0d79-4b1a-ac7a-bddc88e661cf",
|
||||
"model_id": "6832d707-3a51-479e-8860-746803312046",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
}
|
||||
@ -467,7 +370,7 @@
|
||||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "2ebd3f22-c9c2-4948-a6b8-e301f4f14baa",
|
||||
"model_id": "c1b9da4e-1385-457f-a8e3-bed715536d21",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
}
|
||||
@ -516,26 +419,18 @@
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"getField irs IntPairValue\n",
|
||||
"getField frs FloatPairValue"
|
||||
"getField @IntPairValue irs\n",
|
||||
"getField @FloatPairValue frs"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 12,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": []
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"-- We can also set the field!\n",
|
||||
"setField irs IntPairValue (32,42)"
|
||||
"setField @IntPairValue irs (32,42)"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -553,7 +448,7 @@
|
||||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "7a4e0717-fd52-45ab-9fd5-6513b1686d3a",
|
||||
"model_id": "de1fd5a4-0ded-42fe-95bc-49458f2a67da",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
}
|
||||
@ -564,7 +459,7 @@
|
||||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "0f03d310-6e35-4635-bff5-1b34d78661e4",
|
||||
"model_id": "ef687ad0-ce95-43f7-8e40-45fd169f5d2b",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
}
|
||||
@ -577,7 +472,7 @@
|
||||
"gcd a 0 = a\n",
|
||||
"gcd a b = gcd b $ a `mod` b\n",
|
||||
"\n",
|
||||
"setField irs ChangeHandler (getField irs IntPairValue >>= setField intt IntValue . uncurry gcd)\n",
|
||||
"setField @ChangeHandler irs (getField @IntPairValue irs >>= setField @IntValue intt . uncurry gcd)\n",
|
||||
"\n",
|
||||
"irs\n",
|
||||
"intt"
|
||||
@ -596,17 +491,9 @@
|
||||
"cell_type": "code",
|
||||
"execution_count": 14,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": []
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"setField irs ContinuousUpdate False"
|
||||
"setField @ContinuousUpdate irs False"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -622,17 +509,9 @@
|
||||
"cell_type": "code",
|
||||
"execution_count": 15,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": []
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"setField irs Disabled True"
|
||||
"setField @Disabled irs True"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -648,20 +527,12 @@
|
||||
"cell_type": "code",
|
||||
"execution_count": 16,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": []
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"-- First we're gonna enable the widget again\n",
|
||||
"setField irs Disabled False\n",
|
||||
"setField @Disabled irs False\n",
|
||||
"-- We add 4 trailing zeroes\n",
|
||||
"setField irs ReadOutFormat \"04d\"\n",
|
||||
"setField @ReadOutFormat irs \"04d\"\n",
|
||||
"\n",
|
||||
"-- We can disable the readout with\n",
|
||||
"\n",
|
||||
@ -690,7 +561,7 @@
|
||||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "fdc5d66a-a7ad-4b84-bd2e-24630eb4adc0",
|
||||
"model_id": "f3523bee-1592-4948-b76d-4c4d5582ce09",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
}
|
||||
@ -720,8 +591,8 @@
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"setField fnp FloatValue 42.5\n",
|
||||
"getField fnp FloatValue"
|
||||
"setField @FloatValue fnp 42.5\n",
|
||||
"getField @FloatValue fnp"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -739,7 +610,7 @@
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"setField fnp Orientation VerticalOrientation"
|
||||
"setField @Orientation fnp VerticalOrientation"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -757,7 +628,7 @@
|
||||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "c615249d-1c83-4e21-8b96-4183cab62964",
|
||||
"model_id": "543962e4-9539-4519-b584-2aafb45cec05",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
}
|
||||
@ -776,14 +647,14 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 21,
|
||||
"execution_count": 52,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"f :: Integer -> IO ()\n",
|
||||
"f x = do\n",
|
||||
" threadDelay (5*10^4)\n",
|
||||
" setField inp IntValue x\n",
|
||||
" threadDelay $ 10^5\n",
|
||||
" setField @IntValue inp x\n",
|
||||
" \n",
|
||||
"thid <- forkIO $ mapM_ f [0..100]"
|
||||
]
|
||||
@ -799,13 +670,13 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 22,
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "7be98900-12ca-4f6b-8837-0b6679eb933a",
|
||||
"model_id": "ec00ccdc-23d7-44e6-9fc5-a58ed5134b19",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
}
|
||||
@ -816,7 +687,7 @@
|
||||
],
|
||||
"source": [
|
||||
"play <- mkPlay\n",
|
||||
"setField play ChangeHandler (getField play IntValue >>= setField inp IntValue)\n",
|
||||
"setField @ChangeHandler play (getField @IntValue play >>= setField @IntValue inp)\n",
|
||||
"play"
|
||||
]
|
||||
}
|
||||
@ -833,7 +704,7 @@
|
||||
"mimetype": "text/x-haskell",
|
||||
"name": "haskell",
|
||||
"pygments_lexer": "Haskell",
|
||||
"version": "8.10.4"
|
||||
"version": "9.8.2"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
|
@ -57,6 +57,7 @@
|
||||
".hoogle-class {\n",
|
||||
"font-weight: bold;\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
".get-type {\n",
|
||||
"color: green;\n",
|
||||
"font-weight: bold;\n",
|
||||
@ -88,10 +89,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",
|
||||
@ -103,6 +106,7 @@
|
||||
".suggestion-name {\n",
|
||||
"font-weight: bold;\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
"</style><span class='get-type'>plain :: String -> DisplayData</span>"
|
||||
],
|
||||
"text/plain": [
|
||||
@ -150,6 +154,7 @@
|
||||
".hoogle-class {\n",
|
||||
"font-weight: bold;\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
".get-type {\n",
|
||||
"color: green;\n",
|
||||
"font-weight: bold;\n",
|
||||
@ -181,10 +186,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",
|
||||
@ -196,6 +203,7 @@
|
||||
".suggestion-name {\n",
|
||||
"font-weight: bold;\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
"</style><span class='get-type'>html :: String -> DisplayData</span>"
|
||||
],
|
||||
"text/plain": [
|
||||
@ -243,6 +251,7 @@
|
||||
".hoogle-class {\n",
|
||||
"font-weight: bold;\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
".get-type {\n",
|
||||
"color: green;\n",
|
||||
"font-weight: bold;\n",
|
||||
@ -274,10 +283,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",
|
||||
@ -289,6 +300,7 @@
|
||||
".suggestion-name {\n",
|
||||
"font-weight: bold;\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
"</style><span class='get-type'>jpg :: Width -> Height -> Base64 -> DisplayData</span>"
|
||||
],
|
||||
"text/plain": [
|
||||
@ -336,6 +348,7 @@
|
||||
".hoogle-class {\n",
|
||||
"font-weight: bold;\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
".get-type {\n",
|
||||
"color: green;\n",
|
||||
"font-weight: bold;\n",
|
||||
@ -367,10 +380,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",
|
||||
@ -382,10 +397,11 @@
|
||||
".suggestion-name {\n",
|
||||
"font-weight: bold;\n",
|
||||
"}\n",
|
||||
"</style><span class='get-type'>svg :: String -> DisplayData</span>"
|
||||
"\n",
|
||||
"</style><span class='get-type'>svg :: Text -> DisplayData</span>"
|
||||
],
|
||||
"text/plain": [
|
||||
"svg :: String -> DisplayData"
|
||||
"svg :: Text -> DisplayData"
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
@ -429,6 +445,7 @@
|
||||
".hoogle-class {\n",
|
||||
"font-weight: bold;\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
".get-type {\n",
|
||||
"color: green;\n",
|
||||
"font-weight: bold;\n",
|
||||
@ -460,10 +477,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",
|
||||
@ -475,6 +494,7 @@
|
||||
".suggestion-name {\n",
|
||||
"font-weight: bold;\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
"</style><span class='get-type'>latex :: String -> DisplayData</span>"
|
||||
],
|
||||
"text/plain": [
|
||||
@ -522,6 +542,7 @@
|
||||
".hoogle-class {\n",
|
||||
"font-weight: bold;\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
".get-type {\n",
|
||||
"color: green;\n",
|
||||
"font-weight: bold;\n",
|
||||
@ -553,10 +574,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",
|
||||
@ -568,6 +591,7 @@
|
||||
".suggestion-name {\n",
|
||||
"font-weight: bold;\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
"</style><span class='get-type'>javascript :: String -> DisplayData</span>"
|
||||
],
|
||||
"text/plain": [
|
||||
@ -615,6 +639,7 @@
|
||||
".hoogle-class {\n",
|
||||
"font-weight: bold;\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
".get-type {\n",
|
||||
"color: green;\n",
|
||||
"font-weight: bold;\n",
|
||||
@ -646,10 +671,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",
|
||||
@ -661,6 +688,7 @@
|
||||
".suggestion-name {\n",
|
||||
"font-weight: bold;\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
"</style><span class='get-type'>many :: [Display] -> Display</span>"
|
||||
],
|
||||
"text/plain": [
|
||||
@ -692,7 +720,7 @@
|
||||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "65475610-8b2f-46a6-a3a4-5aa92af8466f",
|
||||
"model_id": "ec372cdf-9e7b-4a64-aa85-19ed9e83fd08",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
}
|
||||
@ -774,6 +802,7 @@
|
||||
".hoogle-class {\n",
|
||||
"font-weight: bold;\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
".get-type {\n",
|
||||
"color: green;\n",
|
||||
"font-weight: bold;\n",
|
||||
@ -805,10 +834,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",
|
||||
@ -820,6 +851,7 @@
|
||||
".suggestion-name {\n",
|
||||
"font-weight: bold;\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
"</style><span class='get-type'>appendDisplay :: forall a. IHaskellDisplay a => OutputWidget -> a -> IO ()</span>"
|
||||
],
|
||||
"text/plain": [
|
||||
@ -833,8 +865,8 @@
|
||||
"source": [
|
||||
":t appendDisplay\n",
|
||||
"imgurl <- mkImage\n",
|
||||
"setField imgurl ImageFormat IURL\n",
|
||||
"setField imgurl BSValue \"https://imgs.xkcd.com/comics/functional.png\"\n",
|
||||
"setField @ImageFormat imgurl IURL\n",
|
||||
"setField @BSValue imgurl \"https://imgs.xkcd.com/comics/functional.png\"\n",
|
||||
"appendDisplay o imgurl"
|
||||
]
|
||||
},
|
||||
@ -855,7 +887,7 @@
|
||||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "2cc7d38f-dd7f-429d-b14c-eafa2465e4c1",
|
||||
"model_id": "3b7aef3a-e399-4522-bf2b-635ae4df3657",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
}
|
||||
@ -886,26 +918,19 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 6,
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "0d5927fc-7a68-4603-beec-0c6376f43707",
|
||||
"model_id": "11540503-fb1a-487d-bf12-21a48445d920",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
}
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"text/plain": []
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
@ -915,7 +940,7 @@
|
||||
"\n",
|
||||
"-- Making a button\n",
|
||||
"button <- mkButton\n",
|
||||
"setField button Description \"Hi!\"\n",
|
||||
"setField @Description button \"Hi!\"\n",
|
||||
"\n",
|
||||
"-- Appending the button to the display\n",
|
||||
"appendDisplay o button"
|
||||
@ -934,7 +959,7 @@
|
||||
"mimetype": "text/x-haskell",
|
||||
"name": "haskell",
|
||||
"pygments_lexer": "Haskell",
|
||||
"version": "8.10.4"
|
||||
"version": "9.8.2"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
|
@ -2,107 +2,10 @@
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 30,
|
||||
"execution_count": 1,
|
||||
"id": "c6eaf03d-cf32-448f-949f-1dcafeed8e56",
|
||||
"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",
|
||||
"</style><div class=\"suggestion-name\" style=\"clear:both;\">Unused LANGUAGE pragma</div><div class=\"suggestion-row\" style=\"float: left;\"><div class=\"suggestion-warning\">Found:</div><div class=\"highlight-code\" id=\"haskell\">{-# LANGUAGE OverloadedStrings #-}</div></div><div class=\"suggestion-row\" style=\"float: left;\"><div class=\"suggestion-warning\">Why Not:</div><div class=\"highlight-code\" id=\"haskell\"></div></div>"
|
||||
],
|
||||
"text/plain": [
|
||||
"Line 1: Unused LANGUAGE pragma\n",
|
||||
"Found:\n",
|
||||
"{-# LANGUAGE OverloadedStrings #-}\n",
|
||||
"Why not:"
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"{-# LANGUAGE OverloadedStrings #-}\n",
|
||||
"import Data.Text\n",
|
||||
@ -128,14 +31,14 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 15,
|
||||
"execution_count": 2,
|
||||
"id": "8546ec77-be19-44f3-987e-91eafd890a5a",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "79b44a92-0e84-4efb-9b37-60fb8e7cb579",
|
||||
"model_id": "2287681c-6e9e-4585-97c4-823903305f90",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
}
|
||||
@ -147,7 +50,7 @@
|
||||
"source": [
|
||||
"-- Creating a color widget\n",
|
||||
"colorPicker <- mkColorPicker\n",
|
||||
"setField colorPicker StringValue \"#fabada\"\n",
|
||||
"setField @StringValue colorPicker \"#fabada\"\n",
|
||||
"colorPicker"
|
||||
]
|
||||
},
|
||||
@ -161,12 +64,12 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 16,
|
||||
"execution_count": 3,
|
||||
"id": "phantom-cricket",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"setField colorPicker Concise True"
|
||||
"setField @Concise colorPicker True"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -179,14 +82,14 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 21,
|
||||
"execution_count": 4,
|
||||
"id": "continent-given",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "79b44a92-0e84-4efb-9b37-60fb8e7cb579",
|
||||
"model_id": "2287681c-6e9e-4585-97c4-823903305f90",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
}
|
||||
@ -197,7 +100,7 @@
|
||||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "005e2395-679b-4311-90bb-f793e92b2769",
|
||||
"model_id": "a2fc28ac-9bab-4fcd-9c1d-28324848ee24",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
}
|
||||
@ -210,17 +113,17 @@
|
||||
"-- Creating the button and style\n",
|
||||
"b <- mkButton\n",
|
||||
"stl <- mkButtonStyle\n",
|
||||
"setField b Style $ StyleWidget stl\n",
|
||||
"setField @Style b $ StyleWidget stl\n",
|
||||
"\n",
|
||||
"-- Creating the handler\n",
|
||||
"colorHandler :: IO ()\n",
|
||||
"colorHandler = getField colorPicker StringValue >>= setField stl ButtonColor . Just . unpack\n",
|
||||
"colorHandler = getField @StringValue colorPicker >>= setField @ButtonColor stl . Just . unpack\n",
|
||||
"-- calling the handler to initialize the button\n",
|
||||
"colorHandler\n",
|
||||
"\n",
|
||||
"-- Setting color picker attributes\n",
|
||||
"setField colorPicker Concise False\n",
|
||||
"setField colorPicker ChangeHandler colorHandler\n",
|
||||
"setField @Concise colorPicker False\n",
|
||||
"setField @ChangeHandler colorPicker colorHandler\n",
|
||||
"\n",
|
||||
"-- Displaying the widgets\n",
|
||||
"colorPicker\n",
|
||||
@ -239,30 +142,20 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 24,
|
||||
"execution_count": 5,
|
||||
"id": "fe024e0b-7b08-4fc9-ba22-1e706d31b4b8",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "29a2ae24-caf1-44a0-8275-b60fb4607134",
|
||||
"model_id": "cf98b4a3-8547-4006-b224-fe6df0f079b7",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
}
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
@ -280,14 +173,14 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 32,
|
||||
"execution_count": 8,
|
||||
"id": "purple-specification",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"Today's date is 19/8/2021"
|
||||
"Today's date is 16/10/2024"
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
@ -295,7 +188,7 @@
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"(Date y m d) <- getField datePicker DateValue\n",
|
||||
"(Date y m d) <- getField @DateValue datePicker\n",
|
||||
"printf \"Today's date is %d/%d/%d\" d m y"
|
||||
]
|
||||
},
|
||||
@ -309,12 +202,12 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 26,
|
||||
"execution_count": null,
|
||||
"id": "5789b89d-f0d9-47b8-888f-54d30f4b2a27",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"setField datePicker DateValue NullDate"
|
||||
"setField @DateValue datePicker NullDate"
|
||||
]
|
||||
}
|
||||
],
|
||||
@ -330,7 +223,7 @@
|
||||
"mimetype": "text/x-haskell",
|
||||
"name": "haskell",
|
||||
"pygments_lexer": "Haskell",
|
||||
"version": "8.10.4"
|
||||
"version": "9.8.2"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
|
@ -11,106 +11,9 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"execution_count": null,
|
||||
"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",
|
||||
"</style><div class=\"suggestion-name\" style=\"clear:both;\">Unused LANGUAGE pragma</div><div class=\"suggestion-row\" style=\"float: left;\"><div class=\"suggestion-warning\">Found:</div><div class=\"highlight-code\" id=\"haskell\">{-# LANGUAGE OverloadedStrings #-}</div></div><div class=\"suggestion-row\" style=\"float: left;\"><div class=\"suggestion-warning\">Why Not:</div><div class=\"highlight-code\" id=\"haskell\"></div></div>"
|
||||
],
|
||||
"text/plain": [
|
||||
"Line 1: Unused LANGUAGE pragma\n",
|
||||
"Found:\n",
|
||||
"{-# LANGUAGE OverloadedStrings #-}\n",
|
||||
"Why not:"
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"{-# LANGUAGE OverloadedStrings #-}\n",
|
||||
"{-# LANGUAGE FlexibleContexts #-}\n",
|
||||
@ -126,7 +29,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@ -134,6 +37,7 @@
|
||||
"import Data.Monoid (mempty)\n",
|
||||
"import Data.Text (Text)\n",
|
||||
"import qualified Data.Map as M\n",
|
||||
"import Data.Proxy\n",
|
||||
"\n",
|
||||
"data PlotInfo = PlotInfo {\n",
|
||||
" plotTitle :: String,\n",
|
||||
@ -175,7 +79,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@ -188,8 +92,8 @@
|
||||
"\n",
|
||||
"tempImgWidget <- mkImage\n",
|
||||
"\n",
|
||||
"setField tempImgWidget Width 400\n",
|
||||
"setField tempImgWidget Height 400\n",
|
||||
"setField @Width tempImgWidget 400\n",
|
||||
"setField @Height tempImgWidget 400\n",
|
||||
"\n",
|
||||
"plotState <- newIORef defaultPlotInfo\n",
|
||||
"\n",
|
||||
@ -198,7 +102,7 @@
|
||||
"update modifier = readIORef plotState >>= modifier >>= writeIORef plotState >> redraw\n",
|
||||
"\n",
|
||||
"redraw :: IO ()\n",
|
||||
"redraw = readIORef plotState >>= mkPlot >>= setField tempImgWidget BSValue . JSONByteString\n",
|
||||
"redraw = readIORef plotState >>= mkPlot >>= setField @BSValue tempImgWidget . JSONByteString\n",
|
||||
"\n",
|
||||
"mkDset :: PlotInfo -> [(String, [(Double, Double)])]\n",
|
||||
"mkDset info = let funcs = M.toList $ functions info\n",
|
||||
@ -246,17 +150,9 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 4,
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": []
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"divBox <- mkHBox\n",
|
||||
"\n",
|
||||
@ -265,7 +161,7 @@
|
||||
"tlBox <- mkAccordion\n",
|
||||
"\n",
|
||||
"-- Add the widgets to the main dividing box.\n",
|
||||
"setField divBox Children [ChildWidget plBox, ChildWidget tlBox]"
|
||||
"setField @Children divBox [ChildWidget plBox, ChildWidget tlBox]"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -280,17 +176,9 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 5,
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": []
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"slBox <- mkVBox\n",
|
||||
"\n",
|
||||
@ -298,7 +186,7 @@
|
||||
"let plImg = tempImgWidget\n",
|
||||
"\n",
|
||||
"-- Add widgets to the plotting region.\n",
|
||||
"setField plBox Children [ChildWidget slBox, ChildWidget plImg]"
|
||||
"setField @Children plBox [ChildWidget slBox, ChildWidget plImg]"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -314,17 +202,9 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 6,
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": []
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"-- The four FlexBox widgets.\n",
|
||||
"import Control.Monad (replicateM, forM_)\n",
|
||||
@ -340,8 +220,8 @@
|
||||
"inpts@[plInp,xInp,yInp] <- replicateM 3 mkBoundedFloatText\n",
|
||||
"\n",
|
||||
"-- Adding event handlers for text widgets. This is a clumsy way to emulate first-class record fields.\n",
|
||||
"let setHandler widget field = setField widget ChangeHandler $ update $ \\info -> do\n",
|
||||
" newStr <- getField widget StringValue\n",
|
||||
"let setHandler widget field = setField @ChangeHandler widget $ update $ \\info -> do\n",
|
||||
" newStr <- getField @StringValue widget\n",
|
||||
" return $ field info newStr\n",
|
||||
" in do\n",
|
||||
" setHandler plTxt $ \\struct val -> struct { plotTitle = unpack val }\n",
|
||||
@ -349,8 +229,8 @@
|
||||
" setHandler yTxt $ \\struct val -> struct { yLabel = unpack val }\n",
|
||||
"\n",
|
||||
"-- Adding events for the numeric input widgets.\n",
|
||||
"let setHandler widget field = setField widget ChangeHandler $ update $ \\info -> do\n",
|
||||
" newNum <- getField widget FloatValue\n",
|
||||
"let setHandler widget field = setField @ChangeHandler widget $ update $ \\info -> do\n",
|
||||
" newNum <- getField @FloatValue widget\n",
|
||||
" return $ field info newNum\n",
|
||||
" in do\n",
|
||||
" setHandler plInp $ \\struct val -> struct { plotTitleSize = val }\n",
|
||||
@ -360,26 +240,18 @@
|
||||
"let boxInfo = zip4 boxes texts inpts [\"plot title\", \"X-Label\", \"Y-Label\"]\n",
|
||||
"\n",
|
||||
"forM_ boxInfo $ \\(box,text,input,placeholder) -> do\n",
|
||||
" setField box Children [ChildWidget text, ChildWidget input]\n",
|
||||
" setField text Placeholder $ pack $ printf \"Enter %s here ...\" placeholder\n",
|
||||
" setField input MinFloat 1\n",
|
||||
" setField input MaxFloat 72\n",
|
||||
" setField input FloatValue 10"
|
||||
" setField @Children box [ChildWidget text, ChildWidget input]\n",
|
||||
" setField @Placeholder text $ pack $ printf \"Enter %s here ...\" placeholder\n",
|
||||
" setField @MinFloat input 1\n",
|
||||
" setField @MaxFloat input 72\n",
|
||||
" setField @FloatValue input 10"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 7,
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": []
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"-- A FlexBox with ToggleButtons\n",
|
||||
"buttonBox <- mkHBox\n",
|
||||
@ -387,33 +259,25 @@
|
||||
"\n",
|
||||
"let tgButtonInfo = zip tButtons [\"X-Grid\", \"Y-Grid\"]\n",
|
||||
"\n",
|
||||
"let setHandler widget fieldSetter = setField widget ChangeHandler $ update $ \\info -> do\n",
|
||||
" newStr <- getField widget BoolValue\n",
|
||||
"let setHandler widget fieldSetter = setField @ChangeHandler widget $ update $ \\info -> do\n",
|
||||
" newStr <- getField @BoolValue widget\n",
|
||||
" return $ fieldSetter info newStr\n",
|
||||
" in do\n",
|
||||
" setHandler xGrid $ \\struct val -> struct { showXGrid = val }\n",
|
||||
" setHandler yGrid $ \\struct val -> struct { showYGrid = val }\n",
|
||||
"\n",
|
||||
"forM_ tgButtonInfo $ \\(widget, description) -> do\n",
|
||||
" setField widget Description description\n",
|
||||
" setField widget BoolValue True\n",
|
||||
" setField @Description widget description\n",
|
||||
" setField @BoolValue widget True\n",
|
||||
"\n",
|
||||
"setField buttonBox Children (map ChildWidget tButtons)"
|
||||
"setField @Children buttonBox (map ChildWidget tButtons)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 8,
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": []
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import Control.Arrow (first, second)\n",
|
||||
"\n",
|
||||
@ -424,10 +288,10 @@
|
||||
"let rangeInfo = zip rangeBoxes [(xLow,xHigh), (yLow, yHigh)]\n",
|
||||
"\n",
|
||||
"forM_ rangeInfo $ \\(box, (lowTxt, highTxt)) -> do\n",
|
||||
" setField box Children (map ChildWidget [lowTxt, highTxt])\n",
|
||||
" setField @Children box (map ChildWidget [lowTxt, highTxt])\n",
|
||||
"\n",
|
||||
"let setHandler widget modifier = setField widget ChangeHandler $ update $ \\info -> do\n",
|
||||
" val <- getField widget FloatValue\n",
|
||||
"let setHandler widget modifier = setField @ChangeHandler widget $ update $ \\info -> do\n",
|
||||
" val <- getField @FloatValue widget\n",
|
||||
" return $ modifier val info\n",
|
||||
" in do\n",
|
||||
" setHandler xLow $ \\v p -> p { xRange = first (const v) (xRange p) }\n",
|
||||
@ -445,19 +309,11 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 9,
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": []
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"setField tlBox Children $ map ChildWidget $ boxes ++ [buttonBox] ++ rangeBoxes"
|
||||
"setField @Children tlBox $ map ChildWidget $ boxes ++ [buttonBox] ++ rangeBoxes"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -469,11 +325,11 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 10,
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"setField tlBox Titles [\"Plot title\", \"X-Label\", \"Y-Label\", \"Grid\", \"X-range\", \"Y-range\"]"
|
||||
"setField @Titles tlBox [\"Plot title\", \"X-Label\", \"Y-Label\", \"Grid\", \"X-range\", \"Y-range\"]"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -485,35 +341,27 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 11,
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": []
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"let syncVal widget value fieldGetter = readIORef plotState >>= setField widget value . fieldGetter\n",
|
||||
" in do\n",
|
||||
" syncVal plTxt StringValue (pack . plotTitle)\n",
|
||||
" syncVal plInp FloatValue plotTitleSize\n",
|
||||
"syncVal (Proxy :: Proxy v) widget fieldGetter = readIORef plotState >>= setField @v widget . fieldGetter\n",
|
||||
"\n",
|
||||
" syncVal xTxt StringValue (pack . xLabel)\n",
|
||||
" syncVal xInp FloatValue xLabelSize\n",
|
||||
" syncVal yTxt StringValue (pack . yLabel)\n",
|
||||
" syncVal yInp FloatValue yLabelSize\n",
|
||||
"syncVal (Proxy @StringValue) plTxt (pack . plotTitle)\n",
|
||||
"syncVal (Proxy @FloatValue) plInp plotTitleSize\n",
|
||||
"\n",
|
||||
" syncVal xGrid BoolValue showXGrid\n",
|
||||
" syncVal yGrid BoolValue showYGrid\n",
|
||||
"syncVal (Proxy @StringValue) xTxt (pack . xLabel)\n",
|
||||
"syncVal (Proxy @FloatValue) xInp xLabelSize\n",
|
||||
"syncVal (Proxy @StringValue) yTxt (pack . yLabel)\n",
|
||||
"syncVal (Proxy @FloatValue) yInp yLabelSize\n",
|
||||
"\n",
|
||||
" syncVal xLow FloatValue (fst . xRange)\n",
|
||||
" syncVal xHigh FloatValue (snd . xRange)\n",
|
||||
" syncVal yLow FloatValue (fst . yRange)\n",
|
||||
" syncVal yHigh FloatValue (snd . yRange)"
|
||||
"syncVal (Proxy @BoolValue) xGrid showXGrid\n",
|
||||
"syncVal (Proxy @BoolValue) yGrid showYGrid\n",
|
||||
"\n",
|
||||
"syncVal (Proxy @FloatValue) xLow (fst . xRange)\n",
|
||||
"syncVal (Proxy @FloatValue) xHigh (snd . xRange)\n",
|
||||
"syncVal (Proxy @FloatValue) yLow (fst . yRange)\n",
|
||||
"syncVal (Proxy @FloatValue) yHigh (snd . yRange)"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -525,7 +373,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 12,
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@ -545,226 +393,9 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 13,
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "e094c747-9265-41f1-8c61-4f06b6316d0f",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
}
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"-- Spurious update to display empty plot instead of empty image initially\n",
|
||||
"update return\n",
|
||||
@ -781,7 +412,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 14,
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@ -790,7 +421,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 15,
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@ -799,7 +430,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 16,
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@ -826,7 +457,7 @@
|
||||
"mimetype": "text/x-haskell",
|
||||
"name": "haskell",
|
||||
"pygments_lexer": "Haskell",
|
||||
"version": "8.10.4"
|
||||
"version": "9.8.2"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
|
@ -30,104 +30,7 @@
|
||||
"metadata": {
|
||||
"tags": []
|
||||
},
|
||||
"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",
|
||||
"</style><div class=\"suggestion-name\" style=\"clear:both;\">Unused LANGUAGE pragma</div><div class=\"suggestion-row\" style=\"float: left;\"><div class=\"suggestion-warning\">Found:</div><div class=\"highlight-code\" id=\"haskell\">{-# LANGUAGE OverloadedStrings #-}</div></div><div class=\"suggestion-row\" style=\"float: left;\"><div class=\"suggestion-warning\">Why Not:</div><div class=\"highlight-code\" id=\"haskell\"></div></div>"
|
||||
],
|
||||
"text/plain": [
|
||||
"Line 1: Unused LANGUAGE pragma\n",
|
||||
"Found:\n",
|
||||
"{-# LANGUAGE OverloadedStrings #-}\n",
|
||||
"Why not:"
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"{-# LANGUAGE OverloadedStrings #-}\n",
|
||||
"{-# LANGUAGE FlexibleContexts #-}\n",
|
||||
@ -138,11 +41,20 @@
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"jupyter": {
|
||||
"outputs_hidden": false
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": []
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"-- Allows single selection\n",
|
||||
"tgbs <- mkToggleButtons\n",
|
||||
@ -167,13 +79,13 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 8,
|
||||
"execution_count": 3,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "cc3cb3ef-76c6-45d4-8d94-c9f904128b63",
|
||||
"model_id": "3abd4c34-c04f-4f59-b20c-a25206aa6a93",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
}
|
||||
@ -184,7 +96,7 @@
|
||||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "a217e3a5-6b3a-4195-93f3-3e47a59e7780",
|
||||
"model_id": "c436f5dc-68b8-4265-b7fe-3cde44221ab5",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
}
|
||||
@ -195,7 +107,7 @@
|
||||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "b7e86ecf-da03-4550-9ea9-98649e31b3d3",
|
||||
"model_id": "c9292a02-4ba3-435c-8202-92581524ba8d",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
}
|
||||
@ -206,7 +118,7 @@
|
||||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "9b3a0173-3f8f-4023-97f4-347dd6665f3a",
|
||||
"model_id": "579036b8-e825-4cfb-9c81-da728601c099",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
}
|
||||
@ -217,29 +129,19 @@
|
||||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "f4e42990-e405-47c1-97f0-0f8de2eb8cd9",
|
||||
"model_id": "4a4f263e-f56a-4af1-88db-b97510e941b2",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
}
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"init w = do\n",
|
||||
" setField w Description \"Function:\"\n",
|
||||
" setField w OptionsLabels [\"sin\", \"cos\"]\n",
|
||||
" setField @Description w \"Function:\"\n",
|
||||
" setField @OptionsLabels w [\"sin\", \"cos\"]\n",
|
||||
" return w\n",
|
||||
" \n",
|
||||
"init tgbs\n",
|
||||
@ -258,36 +160,28 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 9,
|
||||
"execution_count": 4,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": []
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"setHandlerOpt w = setField w SelectionHandler $ do\n",
|
||||
" y <- getField w OptionalIndex\n",
|
||||
"setHandlerOpt w = setField @SelectionHandler w $ do\n",
|
||||
" y <- getField @OptionalIndex w\n",
|
||||
" case y of\n",
|
||||
" Just x -> do\n",
|
||||
" setField dropdown OptionalIndex $ Just x\n",
|
||||
" setField tgbs OptionalIndex $ Just x\n",
|
||||
" setField radio OptionalIndex $ Just x\n",
|
||||
" setField select OptionalIndex $ Just x\n",
|
||||
" setField slider Index x\n",
|
||||
" setField @OptionalIndex dropdown $ Just x\n",
|
||||
" setField @OptionalIndex tgbs $ Just x\n",
|
||||
" setField @OptionalIndex radio $ Just x\n",
|
||||
" setField @OptionalIndex select $ Just x\n",
|
||||
" setField @Index slider x\n",
|
||||
" _ -> return ()\n",
|
||||
" \n",
|
||||
"setHandler w = setField w SelectionHandler $ do\n",
|
||||
" x <- getField w Index\n",
|
||||
" setField dropdown OptionalIndex $ Just x\n",
|
||||
" setField tgbs OptionalIndex $ Just x\n",
|
||||
" setField radio OptionalIndex $ Just x\n",
|
||||
" setField select OptionalIndex $ Just x\n",
|
||||
" setField slider Index x\n",
|
||||
"setHandler w = setField @SelectionHandler w $ do\n",
|
||||
" x <- getField @Index w\n",
|
||||
" setField @OptionalIndex dropdown $ Just x\n",
|
||||
" setField @OptionalIndex tgbs $ Just x\n",
|
||||
" setField @OptionalIndex radio $ Just x\n",
|
||||
" setField @OptionalIndex select $ Just x\n",
|
||||
" setField @Index slider x\n",
|
||||
" \n",
|
||||
"\n",
|
||||
"setHandlerOpt tgbs\n",
|
||||
@ -310,13 +204,13 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 20,
|
||||
"execution_count": 5,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "f687e5f8-3df0-4e27-aad2-42e439a32491",
|
||||
"model_id": "ebad2164-fc83-4aad-813d-ea44eae2338d",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
}
|
||||
@ -333,7 +227,7 @@
|
||||
" , \"Madrid\", \"Extremadura\", \"Galicia\", \"La Rioja\", \"Navarre\", \"Murcia\", \"Valencia\"\n",
|
||||
" ]\n",
|
||||
" \n",
|
||||
"setField msel OptionsLabels ccaa\n",
|
||||
"setField @OptionsLabels msel ccaa\n",
|
||||
"msel"
|
||||
]
|
||||
},
|
||||
@ -346,11 +240,11 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 21,
|
||||
"execution_count": 6,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"setField msel Indices [0,2]"
|
||||
"setField @Indices msel [0,2]"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -362,11 +256,11 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 22,
|
||||
"execution_count": 7,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"setField msel Rows $ Just 10"
|
||||
"setField @Rows msel $ Just 10"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -378,43 +272,23 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 25,
|
||||
"execution_count": 9,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "ef3f3191-b86b-4ad8-be4f-b824b9e15786",
|
||||
"model_id": "2fe820d9-9fb7-492a-b126-410c8533098b",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
}
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"setField rslider OptionsLabels [\"Very bad\", \"Bad\", \"Regular\", \"Good\", \"Very good\"]\n",
|
||||
"setField @OptionsLabels rslider [\"Very bad\", \"Bad\", \"Regular\", \"Good\", \"Very good\"]\n",
|
||||
"rslider"
|
||||
]
|
||||
},
|
||||
@ -427,13 +301,13 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 26,
|
||||
"execution_count": 10,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"[1,3]"
|
||||
"[0,0]"
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
@ -441,9 +315,16 @@
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"getField rslider Indices\n",
|
||||
"setField rslider Indices [1,3]"
|
||||
"getField @Indices rslider\n",
|
||||
"setField @Indices rslider [1,3]"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
@ -458,7 +339,7 @@
|
||||
"mimetype": "text/x-haskell",
|
||||
"name": "haskell",
|
||||
"pygments_lexer": "Haskell",
|
||||
"version": "8.10.4"
|
||||
"version": "9.8.2"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
|
@ -27,104 +27,7 @@
|
||||
"metadata": {
|
||||
"tags": []
|
||||
},
|
||||
"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",
|
||||
"</style><div class=\"suggestion-name\" style=\"clear:both;\">Unused LANGUAGE pragma</div><div class=\"suggestion-row\" style=\"float: left;\"><div class=\"suggestion-warning\">Found:</div><div class=\"highlight-code\" id=\"haskell\">{-# LANGUAGE OverloadedStrings #-}</div></div><div class=\"suggestion-row\" style=\"float: left;\"><div class=\"suggestion-warning\">Why Not:</div><div class=\"highlight-code\" id=\"haskell\"></div></div>"
|
||||
],
|
||||
"text/plain": [
|
||||
"Line 1: Unused LANGUAGE pragma\n",
|
||||
"Found:\n",
|
||||
"{-# LANGUAGE OverloadedStrings #-}\n",
|
||||
"Why not:"
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"{-# LANGUAGE OverloadedStrings #-}\n",
|
||||
"{-# LANGUAGE FlexibleContexts #-}\n",
|
||||
@ -133,13 +36,22 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 18,
|
||||
"execution_count": 2,
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"jupyter": {
|
||||
"outputs_hidden": false
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": []
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"-- Constructors\n",
|
||||
"html <- mkHTML\n",
|
||||
@ -172,7 +84,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 10,
|
||||
"execution_count": 3,
|
||||
"metadata": {
|
||||
"tags": []
|
||||
},
|
||||
@ -180,7 +92,7 @@
|
||||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "7d9bbee6-5fc5-4790-b5ae-500d1966750f",
|
||||
"model_id": "4077fda1-f1cf-4ebf-b560-24d3e031b89e",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
}
|
||||
@ -196,8 +108,9 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 12,
|
||||
"execution_count": 4,
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"jupyter": {
|
||||
"outputs_hidden": false
|
||||
}
|
||||
@ -205,13 +118,14 @@
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"-- Set some html string\n",
|
||||
"setField html StringValue \"<b>Hello</b> <i>World!</i>\""
|
||||
"setField @StringValue html \"<b>Hello</b> <i>World!</i>\""
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 13,
|
||||
"execution_count": 5,
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"jupyter": {
|
||||
"outputs_hidden": false
|
||||
}
|
||||
@ -220,7 +134,7 @@
|
||||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "7503927b-868d-42d3-b523-80b1beb891cd",
|
||||
"model_id": "2088fa59-fae3-4756-a7c2-d1ff2adfc298",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
}
|
||||
@ -231,7 +145,7 @@
|
||||
],
|
||||
"source": [
|
||||
"-- Set some latex string\n",
|
||||
"setField htmlMath StringValue \"$$\\\\sum_{i=0}^{i < n} i =\\\\frac{n\\\\cdot(n+1)}{2}$$\"\n",
|
||||
"setField @StringValue htmlMath \"$$\\\\sum_{i=0}^{i < n} i =\\\\frac{n\\\\cdot(n+1)}{2}$$\"\n",
|
||||
"htmlMath"
|
||||
]
|
||||
},
|
||||
@ -251,8 +165,9 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 19,
|
||||
"execution_count": 6,
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"jupyter": {
|
||||
"outputs_hidden": false
|
||||
}
|
||||
@ -261,7 +176,7 @@
|
||||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "93ea02c6-5afc-4e10-813e-3a7d019e4688",
|
||||
"model_id": "1574dfdc-b482-4da1-8d54-4090a0c29632",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
}
|
||||
@ -272,7 +187,7 @@
|
||||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "f06f4e78-7ad0-4309-b094-7f797278ed1e",
|
||||
"model_id": "97e3569f-0081-444c-86b6-9e65ab499163",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
}
|
||||
@ -283,43 +198,13 @@
|
||||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "a5a7eea1-3090-4351-a021-65618ddaa5a5",
|
||||
"model_id": "498d1b85-fca3-48a3-84aa-17822e960bf6",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
}
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
@ -341,56 +226,51 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 25,
|
||||
"execution_count": 7,
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"jupyter": {
|
||||
"outputs_hidden": false
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"setField text Placeholder \"Enter your text here...\"\n",
|
||||
"setField pass Placeholder \"Password\"\n",
|
||||
"setField area Placeholder \"Parsed output will appear here...\""
|
||||
"setField @Placeholder text \"Enter your text here...\"\n",
|
||||
"setField @Placeholder pass \"Password\"\n",
|
||||
"setField @Placeholder area \"Parsed output will appear here...\""
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 27,
|
||||
"execution_count": 8,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"\"\""
|
||||
]
|
||||
"text/plain": []
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"\"agsagsa\""
|
||||
]
|
||||
"text/plain": []
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"\"\""
|
||||
]
|
||||
"text/plain": []
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"getField text StringValue\n",
|
||||
"getField pass StringValue\n",
|
||||
"getField area StringValue"
|
||||
"getField @StringValue text\n",
|
||||
"getField @StringValue pass\n",
|
||||
"getField @StringValue area"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -409,7 +289,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 28,
|
||||
"execution_count": 9,
|
||||
"metadata": {
|
||||
"tags": []
|
||||
},
|
||||
@ -432,7 +312,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 29,
|
||||
"execution_count": 10,
|
||||
"metadata": {
|
||||
"tags": []
|
||||
},
|
||||
@ -493,28 +373,21 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 30,
|
||||
"execution_count": 11,
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"jupyter": {
|
||||
"outputs_hidden": false
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": []
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"setField text ChangeHandler $ do\n",
|
||||
" input <- unpack <$> getField text StringValue\n",
|
||||
"setField @ChangeHandler text $ do\n",
|
||||
" input <- unpack <$> getField @StringValue text\n",
|
||||
" str <- case parse phoneNumber \"<text widget>\" input of\n",
|
||||
" Left error -> return (show error)\n",
|
||||
" Right x -> return (show x)\n",
|
||||
" setField area StringValue (pack str)"
|
||||
" setField @StringValue area (pack str)"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -533,7 +406,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 31,
|
||||
"execution_count": 12,
|
||||
"metadata": {
|
||||
"tags": []
|
||||
},
|
||||
@ -541,7 +414,7 @@
|
||||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "93ea02c6-5afc-4e10-813e-3a7d019e4688",
|
||||
"model_id": "1574dfdc-b482-4da1-8d54-4090a0c29632",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
}
|
||||
@ -552,208 +425,13 @@
|
||||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "a5a7eea1-3090-4351-a021-65618ddaa5a5",
|
||||
"model_id": "498d1b85-fca3-48a3-84aa-17822e960bf6",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
}
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
@ -772,13 +450,13 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 36,
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "6db784a4-191f-4087-bb9a-0a2932eae40e",
|
||||
"model_id": "42d26919-28c0-41b5-9a69-2c37b7fd270c",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
}
|
||||
@ -789,104 +467,31 @@
|
||||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "6c243e81-e59c-453c-98a0-b394c43b4a93",
|
||||
"model_id": "4e1bf52c-ad60-4280-bd94-2b38b953cf8a",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
}
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
},
|
||||
{
|
||||
"data": {},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"valid <- mkValid\n",
|
||||
"pwd <- mkPassword\n",
|
||||
"\n",
|
||||
"setField pwd ChangeHandler $ getField pwd StringValue >>= setField valid BoolValue . (\"1234\"==)\n",
|
||||
"setField @ChangeHandler pwd $ getField @StringValue pwd >>= setField @BoolValue valid . (\"1234\"==)\n",
|
||||
"\n",
|
||||
"pwd\n",
|
||||
"valid"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
@ -901,7 +506,7 @@
|
||||
"mimetype": "text/x-haskell",
|
||||
"name": "haskell",
|
||||
"pygments_lexer": "Haskell",
|
||||
"version": "8.10.4"
|
||||
"version": "9.8.2"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -32,9 +32,9 @@ dwelling into the deeps of the project
|
||||
|
||||
### Add a new attribute
|
||||
If you want to add a new attribute you'll have to:
|
||||
1. Create a new singleton in [Singletons.hs](./Singletons.hs) inside the type `data Field`.
|
||||
2. Write the serialization key of the field as specified in the model (see [MsgSpec.md](./MsgSpec.md)) inside the `toKey` function at [Singletons.hs](./Singletons.hs)
|
||||
3. Because we use the `singletons-th` library, you have to define an alias for the attribute at [Common.hs](./Common.hs) to be able to use it at run-time more easily.
|
||||
1. Create a new data type in [Singletons.hs](./Singletons.hs).
|
||||
2. Write the serialization key of the field as specified in the model (see [MsgSpec.md](./MsgSpec.md)) inside the `ToKey` class at [Singletons.hs](./Singletons.hs)
|
||||
3. Fields that would benefit from helpers or enumerations can be handled in [Common.hs](./Common.hs).
|
||||
4. Now you have to specify the type of the field. Edit the type family `Fieldtype` at [Types.hs](./Types.hs)
|
||||
|
||||
### Add an attribute to a widget
|
||||
@ -65,7 +65,7 @@ You probably got this error when trying to use setField like this:
|
||||
'[]
|
||||
(Data.Vinyl.TypeLevel.RIndex 'ihaskell-widgets-0.3.0.0:IHaskell.Display.Widgets.Singletons.Index '[]))
|
||||
arising from a use of ‘setField’
|
||||
• In the expression: setField select Index 0
|
||||
• In the expression: setField @Index select 0
|
||||
In an equation for ‘it’: it = setField select Index 0
|
||||
```
|
||||
|
||||
@ -82,4 +82,4 @@ If you get an error like this, you probably forgot to put the field name in the
|
||||
In the expression: setField selectMultiple ["Apples", "Oranges", "Pears"]
|
||||
In an equation for ‘it’: it = setField selectMultiple ["Apples", "Oranges", "Pears"]
|
||||
• Relevant bindings include it :: ihaskell-widgets-0.3.0.0:IHaskell.Display.Widgets.Types.FieldType f -> IO () (bound at <interactive>:1:1)
|
||||
```
|
||||
```
|
||||
|
@ -61,6 +61,11 @@ library
|
||||
exposed-modules: IHaskell.Display.Widgets
|
||||
IHaskell.Display.Widgets.Interactive
|
||||
IHaskell.Display.Widgets.Layout
|
||||
IHaskell.Display.Widgets.Layout.Common
|
||||
IHaskell.Display.Widgets.Layout.LayoutWidget
|
||||
IHaskell.Display.Widgets.Layout.Types
|
||||
IHaskell.Display.Widgets.Types
|
||||
IHaskell.Display.Widgets.Common
|
||||
|
||||
-- Modules included in this library but not exported.
|
||||
other-modules: IHaskell.Display.Widgets.Button
|
||||
@ -115,13 +120,6 @@ library
|
||||
IHaskell.Display.Widgets.Style.ProgressStyle
|
||||
IHaskell.Display.Widgets.Style.SliderStyle
|
||||
IHaskell.Display.Widgets.Style.ToggleButtonsStyle
|
||||
|
||||
IHaskell.Display.Widgets.Layout.Common
|
||||
IHaskell.Display.Widgets.Layout.LayoutWidget
|
||||
IHaskell.Display.Widgets.Layout.Types
|
||||
|
||||
IHaskell.Display.Widgets.Types
|
||||
IHaskell.Display.Widgets.Common
|
||||
IHaskell.Display.Widgets.Singletons
|
||||
|
||||
-- LANGUAGE extensions used by modules in this package.
|
||||
@ -140,13 +138,6 @@ library
|
||||
, unix -any
|
||||
, ihaskell >= 0.6.4.1
|
||||
|
||||
-- The singletons package version is locked to the compiler
|
||||
-- so let cabal choose the right one.
|
||||
, singletons -any
|
||||
|
||||
if impl (ghc >= 9.0)
|
||||
build-depends: singletons-base -any
|
||||
|
||||
-- Directories containing source files.
|
||||
hs-source-dirs: src
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE DataKinds #-}
|
||||
{-# LANGUAGE TypeSynonymInstances #-}
|
||||
{-# LANGUAGE TypeApplications #-}
|
||||
|
||||
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
||||
|
||||
@ -30,7 +31,7 @@ import IHaskell.Display.Widgets.Layout.LayoutWidget
|
||||
import IHaskell.Display.Widgets.Style.DescriptionStyle
|
||||
|
||||
-- | A 'CheckBox' represents a Checkbox widget from IPython.html.widgets.
|
||||
type CheckBox = IPythonWidget 'CheckBoxType
|
||||
type CheckBox = IPythonWidget CheckBoxType
|
||||
|
||||
-- | Create a new output widget
|
||||
mkCheckBox :: IO CheckBox
|
||||
@ -41,7 +42,7 @@ mkCheckBox = do
|
||||
dstyle <- mkDescriptionStyle
|
||||
|
||||
let boolAttrs = defaultBoolWidget "CheckboxView" "CheckboxModel" layout $ StyleWidget dstyle
|
||||
checkBoxAttrs = (Indent =:: True)
|
||||
checkBoxAttrs = (F @Indent =:: True)
|
||||
:& RNil
|
||||
widgetState = WidgetState $ boolAttrs <+> checkBoxAttrs
|
||||
|
||||
@ -60,6 +61,6 @@ instance IHaskellWidget CheckBox where
|
||||
comm widget val _ =
|
||||
case nestedObjectLookup val ["state", "value"] of
|
||||
Just (Bool value) -> do
|
||||
void $ setField' widget BoolValue value
|
||||
void $ setField' @BoolValue widget value
|
||||
triggerChange widget
|
||||
_ -> pure ()
|
||||
|
@ -2,6 +2,7 @@
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE DataKinds #-}
|
||||
{-# LANGUAGE TypeSynonymInstances #-}
|
||||
{-# LANGUAGE TypeApplications #-}
|
||||
|
||||
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
||||
|
||||
@ -30,7 +31,7 @@ import IHaskell.Display.Widgets.Layout.LayoutWidget
|
||||
import IHaskell.Display.Widgets.Style.DescriptionStyle
|
||||
|
||||
-- | A 'ToggleButton' represents a ToggleButton widget from IPython.html.widgets.
|
||||
type ToggleButton = IPythonWidget 'ToggleButtonType
|
||||
type ToggleButton = IPythonWidget ToggleButtonType
|
||||
|
||||
-- | Create a new output widget
|
||||
mkToggleButton :: IO ToggleButton
|
||||
@ -41,8 +42,8 @@ mkToggleButton = do
|
||||
dstyle <- mkDescriptionStyle
|
||||
|
||||
let boolState = defaultBoolWidget "ToggleButtonView" "ToggleButtonModel" layout $ StyleWidget dstyle
|
||||
toggleState = (Icon =:: "")
|
||||
:& (ButtonStyle =:: DefaultButton)
|
||||
toggleState = (F @Icon =:: "")
|
||||
:& (F @ButtonStyleField =:: DefaultButton)
|
||||
:& RNil
|
||||
widgetState = WidgetState (boolState <+> toggleState)
|
||||
|
||||
@ -61,6 +62,6 @@ instance IHaskellWidget ToggleButton where
|
||||
comm widget val _ =
|
||||
case nestedObjectLookup val ["state", "value"] of
|
||||
Just (Bool value) -> do
|
||||
void $ setField' widget BoolValue value
|
||||
void $ setField' @BoolValue widget value
|
||||
triggerChange widget
|
||||
_ -> pure ()
|
||||
|
@ -2,6 +2,7 @@
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE DataKinds #-}
|
||||
{-# LANGUAGE TypeSynonymInstances #-}
|
||||
{-# LANGUAGE TypeApplications #-}
|
||||
|
||||
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
||||
|
||||
@ -29,7 +30,7 @@ import IHaskell.Display.Widgets.Layout.LayoutWidget
|
||||
import IHaskell.Display.Widgets.Style.DescriptionStyle
|
||||
|
||||
-- | A 'ValidWidget' represents a Valid widget from IPython.html.widgets.
|
||||
type ValidWidget = IPythonWidget 'ValidType
|
||||
type ValidWidget = IPythonWidget ValidType
|
||||
|
||||
-- | Create a new output widget
|
||||
mkValid :: IO ValidWidget
|
||||
@ -40,7 +41,7 @@ mkValid = do
|
||||
dstyle <- mkDescriptionStyle
|
||||
|
||||
let boolState = defaultBoolWidget "ValidView" "ValidModel" layout $ StyleWidget dstyle
|
||||
validState = (ReadOutMsg =:: "") :& RNil
|
||||
validState = (F @ReadOutMsg =:: "") :& RNil
|
||||
widgetState = WidgetState $ boolState <+> validState
|
||||
|
||||
stateIO <- newIORef widgetState
|
||||
|
@ -26,7 +26,7 @@ import IHaskell.Display.Widgets.Types
|
||||
import IHaskell.Display.Widgets.Layout.LayoutWidget
|
||||
|
||||
-- | A 'Box' represents a Box widget from IPython.html.widgets.
|
||||
type Box = IPythonWidget 'BoxType
|
||||
type Box = IPythonWidget BoxType
|
||||
|
||||
-- | Create a new box
|
||||
mkBox :: IO Box
|
||||
|
@ -26,7 +26,7 @@ import IHaskell.Display.Widgets.Types
|
||||
import IHaskell.Display.Widgets.Layout.LayoutWidget
|
||||
|
||||
-- | A 'GridBox' represents a GridBox widget from IPython.html.widgets.
|
||||
type GridBox = IPythonWidget 'GridBoxType
|
||||
type GridBox = IPythonWidget GridBoxType
|
||||
|
||||
-- | Create a new GridBox
|
||||
mkGridBox :: IO GridBox
|
||||
|
@ -26,7 +26,7 @@ import IHaskell.Display.Widgets.Types
|
||||
import IHaskell.Display.Widgets.Layout.LayoutWidget
|
||||
|
||||
-- | A 'HBox' represents a HBox widget from IPython.html.widgets.
|
||||
type HBox = IPythonWidget 'HBoxType
|
||||
type HBox = IPythonWidget HBoxType
|
||||
|
||||
-- | Create a new HBox
|
||||
mkHBox :: IO HBox
|
||||
|
@ -2,6 +2,7 @@
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE DataKinds #-}
|
||||
{-# LANGUAGE TypeSynonymInstances #-}
|
||||
{-# LANGUAGE TypeApplications #-}
|
||||
|
||||
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
||||
|
||||
@ -29,7 +30,7 @@ import IHaskell.Display.Widgets.Common
|
||||
import IHaskell.Display.Widgets.Layout.LayoutWidget
|
||||
|
||||
-- | A 'Accordion' represents a Accordion widget from IPython.html.widgets.
|
||||
type Accordion = IPythonWidget 'AccordionType
|
||||
type Accordion = IPythonWidget AccordionType
|
||||
|
||||
-- | Create a new box
|
||||
mkAccordion :: IO Accordion
|
||||
@ -55,9 +56,9 @@ instance IHaskellWidget Accordion where
|
||||
comm widget val _ =
|
||||
case nestedObjectLookup val ["state", "selected_index"] of
|
||||
Just (Number num) -> do
|
||||
void $ setField' widget SelectedIndex $ Just (Sci.coefficient num)
|
||||
void $ setField' @SelectedIndex widget $ Just (Sci.coefficient num)
|
||||
triggerChange widget
|
||||
Just Null -> do
|
||||
void $ setField' widget SelectedIndex Nothing
|
||||
void $ setField' @SelectedIndex widget Nothing
|
||||
triggerChange widget
|
||||
_ -> pure ()
|
||||
|
@ -2,6 +2,7 @@
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE DataKinds #-}
|
||||
{-# LANGUAGE TypeSynonymInstances #-}
|
||||
{-# LANGUAGE TypeApplications #-}
|
||||
|
||||
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
||||
|
||||
@ -30,7 +31,7 @@ import IHaskell.Display.Widgets.Common
|
||||
import IHaskell.Display.Widgets.Layout.LayoutWidget
|
||||
|
||||
-- | A 'TabWidget' represents a Tab widget from IPython.html.widgets.
|
||||
type TabWidget = IPythonWidget 'TabType
|
||||
type TabWidget = IPythonWidget TabType
|
||||
|
||||
-- | Create a new box
|
||||
mkTab :: IO TabWidget
|
||||
@ -56,9 +57,9 @@ instance IHaskellWidget TabWidget where
|
||||
comm widget val _ =
|
||||
case nestedObjectLookup val ["state", "selected_index"] of
|
||||
Just (Number num) -> do
|
||||
void $ setField' widget SelectedIndex $ Just (Sci.coefficient num)
|
||||
void $ setField' @SelectedIndex widget $ Just (Sci.coefficient num)
|
||||
triggerChange widget
|
||||
Just Null -> do
|
||||
void $ setField' widget SelectedIndex Nothing
|
||||
void $ setField' @SelectedIndex widget Nothing
|
||||
triggerChange widget
|
||||
_ -> pure ()
|
||||
|
@ -26,7 +26,7 @@ import IHaskell.Display.Widgets.Types
|
||||
import IHaskell.Display.Widgets.Layout.LayoutWidget
|
||||
|
||||
-- | A 'VBox' represents a VBox widget from IPython.html.widgets.
|
||||
type VBox = IPythonWidget 'VBoxType
|
||||
type VBox = IPythonWidget VBoxType
|
||||
|
||||
-- | Create a new VBox
|
||||
mkVBox :: IO VBox
|
||||
|
@ -2,6 +2,7 @@
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE DataKinds #-}
|
||||
{-# LANGUAGE TypeSynonymInstances #-}
|
||||
{-# LANGUAGE TypeApplications #-}
|
||||
|
||||
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
||||
|
||||
@ -29,7 +30,7 @@ import IHaskell.Display.Widgets.Style.ButtonStyle
|
||||
import IHaskell.Display.Widgets.Layout.LayoutWidget
|
||||
|
||||
-- | A 'Button' represents a Button from IPython.html.widgets.
|
||||
type Button = IPythonWidget 'ButtonType
|
||||
type Button = IPythonWidget ButtonType
|
||||
|
||||
-- | Create a new button
|
||||
mkButton :: IO Button
|
||||
@ -40,10 +41,10 @@ mkButton = do
|
||||
btnstyle <- mkButtonStyle
|
||||
|
||||
let ddw = defaultDescriptionWidget "ButtonView" "ButtonModel" layout $ StyleWidget btnstyle
|
||||
but = (Disabled =:: False)
|
||||
:& (Icon =:: "")
|
||||
:& (ButtonStyle =:: DefaultButton)
|
||||
:& (ClickHandler =:: return ())
|
||||
but = (F @Disabled =:: False)
|
||||
:& (F @Icon =:: "")
|
||||
:& (F @ButtonStyleField =:: DefaultButton)
|
||||
:& (F @ClickHandler =:: return ())
|
||||
:& RNil
|
||||
buttonState = WidgetState (ddw <+> but)
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE DataKinds #-}
|
||||
{-# LANGUAGE TypeSynonymInstances #-}
|
||||
{-# LANGUAGE TypeApplications #-}
|
||||
|
||||
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
||||
|
||||
@ -29,7 +30,7 @@ import IHaskell.Display.Widgets.Layout.LayoutWidget
|
||||
import IHaskell.Display.Widgets.Style.DescriptionStyle
|
||||
|
||||
-- | A 'ColorPicker' represents a ColorPicker from IPython.html.widgets.
|
||||
type ColorPicker = IPythonWidget 'ColorPickerType
|
||||
type ColorPicker = IPythonWidget ColorPickerType
|
||||
|
||||
-- | Create a new ColorPicker
|
||||
mkColorPicker :: IO ColorPicker
|
||||
@ -40,10 +41,10 @@ mkColorPicker = do
|
||||
dstyle <- mkDescriptionStyle
|
||||
|
||||
let ddw = defaultDescriptionWidget "ColorPickerView" "ColorPickerModel" layout $ StyleWidget dstyle
|
||||
color = (StringValue =:: "black")
|
||||
:& (Concise =:: False)
|
||||
:& (Disabled =:: False)
|
||||
:& (ChangeHandler =:: return ())
|
||||
color = (F @StringValue =:: "black")
|
||||
:& (F @Concise =:: False)
|
||||
:& (F @Disabled =:: False)
|
||||
:& (F @ChangeHandler =:: return ())
|
||||
:& RNil
|
||||
colorPickerState = WidgetState (ddw <+> color)
|
||||
|
||||
@ -62,6 +63,6 @@ instance IHaskellWidget ColorPicker where
|
||||
comm widget val _ =
|
||||
case nestedObjectLookup val ["state", "value"] of
|
||||
Just o -> case fromJSON o of
|
||||
Success (String color) -> setField' widget StringValue color >> triggerChange widget
|
||||
Success (String color) -> setField' @StringValue widget color >> triggerChange widget
|
||||
_ -> pure ()
|
||||
_ -> pure ()
|
||||
|
@ -13,7 +13,10 @@
|
||||
{-# OPTIONS_GHC -fno-warn-missing-pattern-synonym-signatures #-}
|
||||
{-# OPTIONS_GHC -fno-warn-missing-signatures #-}
|
||||
|
||||
module IHaskell.Display.Widgets.Common where
|
||||
module IHaskell.Display.Widgets.Common (
|
||||
module IHaskell.Display.Widgets.Common,
|
||||
module IHaskell.Display.Widgets.Singletons
|
||||
) where
|
||||
|
||||
import Data.Aeson
|
||||
import Data.Aeson.Types (emptyObject)
|
||||
@ -24,6 +27,7 @@ import IHaskell.Display (IHaskellWidget)
|
||||
import IHaskell.Eval.Widgets (widgetSendClose)
|
||||
|
||||
import qualified IHaskell.Display.Widgets.Singletons as S
|
||||
import IHaskell.Display.Widgets.Singletons
|
||||
|
||||
#if MIN_VERSION_aeson(2,0,0)
|
||||
import qualified Data.Aeson.KeyMap as KeyMap
|
||||
@ -32,201 +36,6 @@ import qualified Data.Aeson.Key as Key
|
||||
import Data.HashMap.Strict as HM
|
||||
#endif
|
||||
|
||||
-- | The view module string
|
||||
pattern ViewModule = S.SViewModule
|
||||
-- | The view module version
|
||||
pattern ViewModuleVersion = S.SViewModuleVersion
|
||||
-- | The view name
|
||||
pattern ViewName = S.SViewName
|
||||
-- | The model module string
|
||||
pattern ModelModule = S.SModelModule
|
||||
-- | The model module version
|
||||
pattern ModelModuleVersion = S.SModelModuleVersion
|
||||
-- | The model name
|
||||
pattern ModelName = S.SModelName
|
||||
-- | A method to be called on display
|
||||
pattern DisplayHandler = S.SDisplayHandler
|
||||
-- | CSS classes applied to widget DOM element
|
||||
pattern DOMClasses = S.SDOMClasses
|
||||
-- | Reference to a Layout widget
|
||||
pattern Layout = S.SLayout
|
||||
-- | Width of the video/image in pixels
|
||||
pattern Width = S.SWidth
|
||||
-- | Height of the video/image in pixels
|
||||
pattern Height = S.SHeight
|
||||
-- | Description of the control
|
||||
pattern Description = S.SDescription
|
||||
-- | Allow html in description
|
||||
pattern DescriptionAllowHtml = S.SDescriptionAllowHtml
|
||||
-- | Method to be called on click
|
||||
pattern ClickHandler = S.SClickHandler
|
||||
-- | Method to be called on submit
|
||||
pattern SubmitHandler = S.SSubmitHandler
|
||||
-- | Whether the widget appears as disabled on the frontend
|
||||
pattern Disabled = S.SDisabled
|
||||
-- | The value of the widget, of type string
|
||||
pattern StringValue = S.SStringValue
|
||||
-- | Placeholder text to display if nothing has been typed yet
|
||||
pattern Placeholder = S.SPlaceholder
|
||||
-- | Tooltip for the description
|
||||
pattern Tooltip = S.STooltip
|
||||
-- | Is the widget tabbable?
|
||||
pattern Tabbable = S.STabbable
|
||||
-- | The font-awesome icon without the fa-
|
||||
pattern Icon = S.SIcon
|
||||
-- | Predefined styling for the button
|
||||
pattern ButtonStyle = S.SButtonStyle
|
||||
-- | Value of the widget of type bytestring
|
||||
pattern BSValue = S.SBSValue
|
||||
-- | The format of the image
|
||||
pattern ImageFormat = S.SImageFormat
|
||||
-- | The value of the widget of type bool
|
||||
pattern BoolValue = S.SBoolValue
|
||||
-- | The labels for the options
|
||||
pattern OptionsLabels = S.SOptionsLabels
|
||||
-- | Selected index, can be Nothing
|
||||
pattern OptionalIndex = S.SOptionalIndex
|
||||
-- | The index of the controller
|
||||
pattern Index = S.SIndex
|
||||
-- | Method to be called when something is chosen
|
||||
pattern SelectionHandler = S.SSelectionHandler
|
||||
-- | Tooltips for each button
|
||||
pattern Tooltips = S.STooltips
|
||||
-- | Icons names for each button (FontAwesome names without the fa- prefix)
|
||||
pattern Icons = S.SIcons
|
||||
-- | Selected indices
|
||||
pattern Indices = S.SIndices
|
||||
-- | The value of the widget of type int
|
||||
pattern IntValue = S.SIntValue
|
||||
-- | Minimum step to increment the value
|
||||
pattern StepInt = S.SStepInt
|
||||
-- | Max value
|
||||
pattern MaxInt = S.SMaxInt
|
||||
-- | Min value
|
||||
pattern MinInt = S.SMinInt
|
||||
-- | The value of the widget as an int pair
|
||||
pattern IntPairValue = S.SIntPairValue
|
||||
-- | Min value on a range widget
|
||||
pattern LowerInt = S.SLowerInt
|
||||
-- | Max value on a range widget
|
||||
pattern UpperInt = S.SUpperInt
|
||||
-- | Value of the widget (float)
|
||||
pattern FloatValue = S.SFloatValue
|
||||
-- | Minimum step to increment the value
|
||||
pattern StepFloat = S.SStepFloat
|
||||
-- | Max value
|
||||
pattern MaxFloat = S.SMaxFloat
|
||||
-- | Min value
|
||||
pattern MinFloat = S.SMinFloat
|
||||
-- | Value of the widget as a float pair
|
||||
pattern FloatPairValue = S.SFloatPairValue
|
||||
-- | Min value of a range widget
|
||||
pattern LowerFloat = S.SLowerFloat
|
||||
-- | Max value of a range widget
|
||||
pattern UpperFloat = S.SUpperFloat
|
||||
-- | Orientation of the widget
|
||||
pattern Orientation = S.SOrientation
|
||||
-- | The logarithmic base of the widget
|
||||
pattern BaseFloat = S.SBaseFloat
|
||||
-- | Whether to display the current value of the widget next to it
|
||||
pattern ReadOut = S.SReadOut
|
||||
-- | The format of the readout
|
||||
pattern ReadOutFormat = S.SReadOutFormat
|
||||
-- | Use a predefined styling for the bar
|
||||
pattern BarStyle = S.SBarStyle
|
||||
-- | A method called when the value changes in the fronted
|
||||
pattern ChangeHandler = S.SChangeHandler
|
||||
-- | List of widget children
|
||||
pattern Children = S.SChildren
|
||||
-- | Use a predefined styling for the box
|
||||
pattern BoxStyle = S.SBoxStyle
|
||||
-- | Titles of the pages
|
||||
pattern Titles = S.STitles
|
||||
-- | The index of the selected page. Is nothing if no widgets are selected.
|
||||
pattern SelectedIndex = S.SSelectedIndex
|
||||
-- | Message displayed when the value is false
|
||||
pattern ReadOutMsg = S.SReadOutMsg
|
||||
-- | Indent the control to align with other controls with a description
|
||||
pattern Indent = S.SIndent
|
||||
-- | Update the value as the user types. If false, update on submission.
|
||||
pattern ContinuousUpdate = S.SContinuousUpdate
|
||||
-- | The number of rows to display
|
||||
pattern Rows = S.SRows
|
||||
-- | The format of the audio
|
||||
pattern AudioFormat = S.SAudioFormat
|
||||
-- | The format of the image
|
||||
pattern VideoFormat = S.SVideoFormat
|
||||
-- | When true, the video starts on display
|
||||
pattern AutoPlay = S.SAutoPlay
|
||||
-- | When true, the video starts from the beginning after finishing
|
||||
pattern Loop = S.SLoop
|
||||
-- | Specifies that video controls should be displayed
|
||||
pattern Controls = S.SControls
|
||||
-- | Dropdown options for the combobox
|
||||
pattern Options = S.SOptions
|
||||
-- | If set, ensure the value is in options
|
||||
pattern EnsureOption = S.SEnsureOption
|
||||
-- | Whether the control is currently playing
|
||||
pattern Playing = S.SPlaying
|
||||
-- | Whether the control will repeat in a continuous loop
|
||||
pattern Repeat = S.SRepeat
|
||||
-- | The maximum interval for the play control
|
||||
pattern Interval = S.SInterval
|
||||
-- | Show the repeat toggle button on the widget
|
||||
pattern ShowRepeat = S.SShowRepeat
|
||||
-- | Display the short version of the selector
|
||||
pattern Concise = S.SConcise
|
||||
-- | The value of the widget in date format
|
||||
pattern DateValue = S.SDateValue
|
||||
-- | Whether the button is pressed
|
||||
pattern Pressed = S.SPressed
|
||||
-- | The name of the controller
|
||||
pattern Name = S.SName
|
||||
-- | The name of the control mapping
|
||||
pattern Mapping = S.SMapping
|
||||
-- | Whether the gamepad is connected
|
||||
pattern Connected = S.SConnected
|
||||
-- | The last time the data from this gamepad was updated
|
||||
pattern Timestamp = S.STimestamp
|
||||
-- | The button widgets on the gamepad
|
||||
pattern Buttons = S.SButtons
|
||||
-- | The axes on the gamepad
|
||||
pattern Axes = S.SAxes
|
||||
-- | Color of the button
|
||||
pattern ButtonColor = S.SButtonColor
|
||||
-- | The font family of the text
|
||||
pattern FontFamily = S.SFontFamily
|
||||
-- | The font weight of the text
|
||||
pattern FontSize = S.SFontSize
|
||||
-- | The font style of the text
|
||||
pattern FontStyle = S.SFontStyle
|
||||
-- | The font variant of the text
|
||||
pattern FontVariant = S.SFontVariant
|
||||
-- | The text color of the text
|
||||
pattern FontWeight = S.SFontWeight
|
||||
-- | The font size of the text
|
||||
pattern TextColor = S.STextColor
|
||||
-- | The text decoration of the text
|
||||
pattern TextDecoration = S.STextDecoration
|
||||
-- | Width of the description to the side of the control
|
||||
pattern DescriptionWidth = S.SDescriptionWidth
|
||||
-- | Color of the progress bar
|
||||
pattern BarColor = S.SBarColor
|
||||
-- | Color of the slider handle
|
||||
pattern HandleColor = S.SHandleColor
|
||||
-- | The width of each button
|
||||
pattern ButtonWidth = S.SButtonWidth
|
||||
-- | The target (widget,field) pair
|
||||
pattern Target = S.STarget
|
||||
-- | The source (widget,field) pair
|
||||
pattern Source = S.SSource
|
||||
-- | Parent message id of messages to capture
|
||||
pattern MsgID = S.SMsgID
|
||||
-- | The output messages synced from the frontend
|
||||
pattern Outputs = S.SOutputs
|
||||
-- | Reference to a Style widget with styling customizations
|
||||
pattern Style = S.SStyle
|
||||
|
||||
-- | Close a widget's comm
|
||||
closeWidget :: IHaskellWidget w => w -> IO ()
|
||||
closeWidget w = widgetSendClose w emptyObject
|
||||
|
@ -3,6 +3,11 @@
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE DataKinds #-}
|
||||
{-# LANGUAGE TypeSynonymInstances #-}
|
||||
{-# LANGUAGE TypeApplications #-}
|
||||
{-# LANGUAGE RankNTypes #-}
|
||||
{-# LANGUAGE ScopedTypeVariables #-}
|
||||
{-# LANGUAGE AllowAmbiguousTypes #-}
|
||||
{-# LANGUAGE MonoLocalBinds #-}
|
||||
|
||||
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
||||
|
||||
@ -32,7 +37,7 @@ import IHaskell.Display.Widgets.Common
|
||||
import IHaskell.Display.Widgets.Layout.LayoutWidget
|
||||
|
||||
-- | 'Controller' represents an Controller widget from IPython.html.widgets.
|
||||
type Controller = IPythonWidget 'ControllerType
|
||||
type Controller = IPythonWidget ControllerType
|
||||
|
||||
-- | Create a new widget
|
||||
mkController :: IO Controller
|
||||
@ -42,14 +47,14 @@ mkController = do
|
||||
layout <- mkLayout
|
||||
|
||||
let domAttrs = defaultCoreWidget <+> defaultDOMWidget "ControllerView" "ControllerModel" layout
|
||||
ctrlAttrs = (Index =:+ 0)
|
||||
:& (Name =:! "")
|
||||
:& (Mapping =:! "")
|
||||
:& (Connected =:! False)
|
||||
:& (Timestamp =:! 0.0)
|
||||
:& (Buttons =:! [])
|
||||
:& (Axes =:! [])
|
||||
:& (ChangeHandler =:: pure ())
|
||||
ctrlAttrs = (F @Index =:+ 0)
|
||||
:& (F @Name =:! "")
|
||||
:& (F @Mapping =:! "")
|
||||
:& (F @Connected =:! False)
|
||||
:& (F @Timestamp =:! 0.0)
|
||||
:& (F @Buttons =:! [])
|
||||
:& (F @Axes =:! [])
|
||||
:& (F @ChangeHandler =:: pure ())
|
||||
:& RNil
|
||||
widgetState = WidgetState $ domAttrs <+> ctrlAttrs
|
||||
|
||||
@ -68,12 +73,15 @@ instance IHaskellWidget Controller where
|
||||
comm widget val _ =
|
||||
case nestedObjectLookup val ["state"] of
|
||||
Just (Object o) -> do
|
||||
parseAndSet Name "name"
|
||||
parseAndSet Mapping "mapping"
|
||||
parseAndSet Connected "connected"
|
||||
parseAndSet Timestamp "timestamp"
|
||||
parseAndSet @Name "name"
|
||||
parseAndSet @Mapping "mapping"
|
||||
parseAndSet @Connected "connected"
|
||||
parseAndSet @Timestamp "timestamp"
|
||||
triggerChange widget
|
||||
where parseAndSet f s = case parse (.: s) o of
|
||||
Success x -> void $ setField' widget f x
|
||||
where parseAndSet :: forall f. (RElemOf f (WidgetFields ControllerType),
|
||||
IHaskellWidget Controller,
|
||||
ToKey f, FromJSON (FieldType f)) => Key -> IO ()
|
||||
parseAndSet s = case parse (.: s) o of
|
||||
Success x -> void $ setField' @f widget x
|
||||
_ -> pure ()
|
||||
_ -> pure ()
|
||||
|
@ -2,6 +2,7 @@
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE DataKinds #-}
|
||||
{-# LANGUAGE TypeSynonymInstances #-}
|
||||
{-# LANGUAGE TypeApplications #-}
|
||||
|
||||
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
||||
|
||||
@ -28,7 +29,7 @@ import IHaskell.Display.Widgets.Common
|
||||
import IHaskell.Display.Widgets.Layout.LayoutWidget
|
||||
|
||||
-- | 'ControllerAxis' represents an ControllerAxis widget from IPython.html.widgets.
|
||||
type ControllerAxis = IPythonWidget 'ControllerAxisType
|
||||
type ControllerAxis = IPythonWidget ControllerAxisType
|
||||
|
||||
-- | Create a new widget
|
||||
mkControllerAxis :: IO ControllerAxis
|
||||
@ -38,8 +39,8 @@ mkControllerAxis = do
|
||||
layout <- mkLayout
|
||||
|
||||
let domAttrs = defaultCoreWidget <+> defaultDOMWidget "ControllerAxisView" "ControllerAxisModel" layout
|
||||
axisAttrs = (FloatValue =:! 0.0)
|
||||
:& (ChangeHandler =:: pure ())
|
||||
axisAttrs = (F @FloatValue =:! 0.0)
|
||||
:& (F @ChangeHandler =:: pure ())
|
||||
:& RNil
|
||||
widgetState = WidgetState $ domAttrs <+> axisAttrs
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE DataKinds #-}
|
||||
{-# LANGUAGE TypeSynonymInstances #-}
|
||||
{-# LANGUAGE TypeApplications #-}
|
||||
|
||||
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
||||
|
||||
@ -28,7 +29,7 @@ import IHaskell.Display.Widgets.Common
|
||||
import IHaskell.Display.Widgets.Layout.LayoutWidget
|
||||
|
||||
-- | 'ControllerButton' represents an ControllerButton widget from IPython.html.widgets.
|
||||
type ControllerButton = IPythonWidget 'ControllerButtonType
|
||||
type ControllerButton = IPythonWidget ControllerButtonType
|
||||
|
||||
-- | Create a new widget
|
||||
mkControllerButton :: IO ControllerButton
|
||||
@ -38,9 +39,9 @@ mkControllerButton = do
|
||||
layout <- mkLayout
|
||||
|
||||
let domAttrs = defaultCoreWidget <+> defaultDOMWidget "ControllerButtonView" "ControllerButtonModel" layout
|
||||
btnAttrs = (FloatValue =:! 0.0)
|
||||
:& (Pressed =:! False)
|
||||
:& (ChangeHandler =:: pure ())
|
||||
btnAttrs = (F @FloatValue =:! 0.0)
|
||||
:& (F @Pressed =:! False)
|
||||
:& (F @ChangeHandler =:: pure ())
|
||||
:& RNil
|
||||
widgetState = WidgetState $ domAttrs <+> btnAttrs
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE DataKinds #-}
|
||||
{-# LANGUAGE TypeSynonymInstances #-}
|
||||
{-# LANGUAGE TypeApplications #-}
|
||||
|
||||
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
||||
|
||||
@ -29,7 +30,7 @@ import IHaskell.Display.Widgets.Layout.LayoutWidget
|
||||
import IHaskell.Display.Widgets.Style.DescriptionStyle
|
||||
|
||||
-- | A 'DatePicker' represents a DatePicker from IPython.html.widgets.
|
||||
type DatePicker = IPythonWidget 'DatePickerType
|
||||
type DatePicker = IPythonWidget DatePickerType
|
||||
|
||||
-- | Create a new DatePicker
|
||||
mkDatePicker :: IO DatePicker
|
||||
@ -40,9 +41,9 @@ mkDatePicker = do
|
||||
dstyle <- mkDescriptionStyle
|
||||
|
||||
let ddw = defaultDescriptionWidget "DatePickerView" "DatePickerModel" layout $ StyleWidget dstyle
|
||||
date = (DateValue =:: defaultDate)
|
||||
:& (Disabled =:: False)
|
||||
:& (ChangeHandler =:: return ())
|
||||
date = (F @DateValue =:: defaultDate)
|
||||
:& (F @Disabled =:: False)
|
||||
:& (F @ChangeHandler =:: return ())
|
||||
:& RNil
|
||||
datePickerState = WidgetState (ddw <+> date)
|
||||
|
||||
@ -61,6 +62,6 @@ instance IHaskellWidget DatePicker where
|
||||
comm widget val _ =
|
||||
case nestedObjectLookup val ["state", "value"] of
|
||||
Just o -> case fromJSON o of
|
||||
Success date -> setField' widget DateValue date >> triggerChange widget
|
||||
Success date -> setField' @DateValue widget date >> triggerChange widget
|
||||
_ -> pure ()
|
||||
_ -> pure ()
|
||||
_ -> pure ()
|
||||
|
@ -2,6 +2,7 @@
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE DataKinds #-}
|
||||
{-# LANGUAGE TypeSynonymInstances #-}
|
||||
{-# LANGUAGE TypeApplications #-}
|
||||
|
||||
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
||||
|
||||
@ -31,7 +32,7 @@ import IHaskell.Display.Widgets.Layout.LayoutWidget
|
||||
import IHaskell.Display.Widgets.Style.DescriptionStyle
|
||||
|
||||
-- | 'BoundedFloatText' represents an BoundedFloatText widget from IPython.html.widgets.
|
||||
type BoundedFloatText = IPythonWidget 'BoundedFloatTextType
|
||||
type BoundedFloatText = IPythonWidget BoundedFloatTextType
|
||||
|
||||
-- | Create a new widget
|
||||
mkBoundedFloatText :: IO BoundedFloatText
|
||||
@ -42,9 +43,9 @@ mkBoundedFloatText = do
|
||||
dstyle <- mkDescriptionStyle
|
||||
|
||||
let boundedFloatAttrs = defaultBoundedFloatWidget "FloatTextView" "BoundedFloatTextModel" layout $ StyleWidget dstyle
|
||||
textAttrs = (Disabled =:: False)
|
||||
:& (ContinuousUpdate =:: False)
|
||||
:& (StepFloat =:: Nothing)
|
||||
textAttrs = (F @Disabled =:: False)
|
||||
:& (F @ContinuousUpdate =:: False)
|
||||
:& (F @StepFloat =:: Nothing)
|
||||
:& RNil
|
||||
widgetState = WidgetState $ boundedFloatAttrs <+> textAttrs
|
||||
|
||||
@ -63,6 +64,6 @@ instance IHaskellWidget BoundedFloatText where
|
||||
comm widget val _ =
|
||||
case nestedObjectLookup val ["state", "value"] of
|
||||
Just (Number value) -> do
|
||||
void $ setField' widget FloatValue (Sci.toRealFloat value)
|
||||
void $ setField' @FloatValue widget (Sci.toRealFloat value)
|
||||
triggerChange widget
|
||||
_ -> pure ()
|
||||
|
@ -2,6 +2,7 @@
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE DataKinds #-}
|
||||
{-# LANGUAGE TypeSynonymInstances #-}
|
||||
{-# LANGUAGE TypeApplications #-}
|
||||
|
||||
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
||||
|
||||
@ -31,7 +32,7 @@ import IHaskell.Display.Widgets.Layout.LayoutWidget
|
||||
import IHaskell.Display.Widgets.Style.DescriptionStyle
|
||||
|
||||
-- | 'FloatLogSlider' represents an FloatLogSlider widget from IPython.html.widgets.
|
||||
type FloatLogSlider = IPythonWidget 'FloatLogSliderType
|
||||
type FloatLogSlider = IPythonWidget FloatLogSliderType
|
||||
|
||||
-- | Create a new widget
|
||||
mkFloatLogSlider :: IO FloatLogSlider
|
||||
@ -42,13 +43,13 @@ mkFloatLogSlider = do
|
||||
dstyle <- mkDescriptionStyle
|
||||
|
||||
let boundedLogFloatAttrs = defaultBoundedLogFloatWidget "FloatLogSliderView" "FloatLogSliderModel" layout $ StyleWidget dstyle
|
||||
sliderAttrs = (StepFloat =:: Just 0.1)
|
||||
:& (Orientation =:: HorizontalOrientation)
|
||||
:& (ReadOut =:: True)
|
||||
:& (ReadOutFormat =:: ".3g")
|
||||
:& (ContinuousUpdate =:: True)
|
||||
:& (Disabled =:: False)
|
||||
:& (BaseFloat =:: 10.0)
|
||||
sliderAttrs = (F @StepFloat =:: Just 0.1)
|
||||
:& (F @Orientation =:: HorizontalOrientation)
|
||||
:& (F @ReadOut =:: True)
|
||||
:& (F @ReadOutFormat =:: ".3g")
|
||||
:& (F @ContinuousUpdate =:: True)
|
||||
:& (F @Disabled =:: False)
|
||||
:& (F @BaseFloat =:: 10.0)
|
||||
:& RNil
|
||||
widgetState = WidgetState $ boundedLogFloatAttrs <+> sliderAttrs
|
||||
|
||||
@ -67,6 +68,6 @@ instance IHaskellWidget FloatLogSlider where
|
||||
comm widget val _ =
|
||||
case nestedObjectLookup val ["state", "value"] of
|
||||
Just (Number value) -> do
|
||||
void $ setField' widget FloatValue (Sci.toRealFloat value)
|
||||
void $ setField' @FloatValue widget (Sci.toRealFloat value)
|
||||
triggerChange widget
|
||||
_ -> pure ()
|
||||
|
@ -2,6 +2,7 @@
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE DataKinds #-}
|
||||
{-# LANGUAGE TypeSynonymInstances #-}
|
||||
{-# LANGUAGE TypeApplications #-}
|
||||
|
||||
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
||||
|
||||
@ -29,7 +30,7 @@ import IHaskell.Display.Widgets.Layout.LayoutWidget
|
||||
import IHaskell.Display.Widgets.Style.ProgressStyle
|
||||
|
||||
-- | 'FloatProgress' represents an FloatProgress widget from IPython.html.widgets.
|
||||
type FloatProgress = IPythonWidget 'FloatProgressType
|
||||
type FloatProgress = IPythonWidget FloatProgressType
|
||||
|
||||
-- | Create a new widget
|
||||
mkFloatProgress :: IO FloatProgress
|
||||
@ -40,8 +41,8 @@ mkFloatProgress = do
|
||||
pstyle <- mkProgressStyle
|
||||
|
||||
let boundedFloatAttrs = defaultBoundedFloatWidget "ProgressView" "FloatProgressModel" layout $ StyleWidget pstyle
|
||||
progressAttrs = (Orientation =:: HorizontalOrientation)
|
||||
:& (BarStyle =:: DefaultBar)
|
||||
progressAttrs = (F @Orientation =:: HorizontalOrientation)
|
||||
:& (F @BarStyle =:: DefaultBar)
|
||||
:& RNil
|
||||
widgetState = WidgetState $ boundedFloatAttrs <+> progressAttrs
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE DataKinds #-}
|
||||
{-# LANGUAGE TypeSynonymInstances #-}
|
||||
{-# LANGUAGE TypeApplications #-}
|
||||
|
||||
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
||||
|
||||
@ -31,7 +32,7 @@ import IHaskell.Display.Widgets.Layout.LayoutWidget
|
||||
import IHaskell.Display.Widgets.Style.DescriptionStyle
|
||||
|
||||
-- | 'FloatSlider' represents an FloatSlider widget from IPython.html.widgets.
|
||||
type FloatSlider = IPythonWidget 'FloatSliderType
|
||||
type FloatSlider = IPythonWidget FloatSliderType
|
||||
|
||||
-- | Create a new widget
|
||||
mkFloatSlider :: IO FloatSlider
|
||||
@ -42,12 +43,12 @@ mkFloatSlider = do
|
||||
dstyle <- mkDescriptionStyle
|
||||
|
||||
let boundedFloatAttrs = defaultBoundedFloatWidget "FloatSliderView" "FloatSliderModel" layout $ StyleWidget dstyle
|
||||
sliderAttrs = (StepFloat =:: Just 0.1)
|
||||
:& (Orientation =:: HorizontalOrientation)
|
||||
:& (ReadOut =:: True)
|
||||
:& (ReadOutFormat =:: ".2f")
|
||||
:& (ContinuousUpdate =:: True)
|
||||
:& (Disabled =:: False)
|
||||
sliderAttrs = (F @StepFloat =:: Just 0.1)
|
||||
:& (F @Orientation =:: HorizontalOrientation)
|
||||
:& (F @ReadOut =:: True)
|
||||
:& (F @ReadOutFormat =:: ".2f")
|
||||
:& (F @ContinuousUpdate =:: True)
|
||||
:& (F @Disabled =:: False)
|
||||
:& RNil
|
||||
widgetState = WidgetState $ boundedFloatAttrs <+> sliderAttrs
|
||||
|
||||
@ -66,6 +67,6 @@ instance IHaskellWidget FloatSlider where
|
||||
comm widget val _ =
|
||||
case nestedObjectLookup val ["state", "value"] of
|
||||
Just (Number value) -> do
|
||||
void $ setField' widget FloatValue (Sci.toRealFloat value)
|
||||
void $ setField' @FloatValue widget (Sci.toRealFloat value)
|
||||
triggerChange widget
|
||||
_ -> pure ()
|
||||
|
@ -2,6 +2,7 @@
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE DataKinds #-}
|
||||
{-# LANGUAGE TypeSynonymInstances #-}
|
||||
{-# LANGUAGE TypeApplications #-}
|
||||
|
||||
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
||||
|
||||
@ -32,7 +33,7 @@ import IHaskell.Display.Widgets.Layout.LayoutWidget
|
||||
import IHaskell.Display.Widgets.Style.DescriptionStyle
|
||||
|
||||
-- | 'FloatRangeSlider' represents an FloatRangeSlider widget from IPython.html.widgets.
|
||||
type FloatRangeSlider = IPythonWidget 'FloatRangeSliderType
|
||||
type FloatRangeSlider = IPythonWidget FloatRangeSliderType
|
||||
|
||||
-- | Create a new widget
|
||||
mkFloatRangeSlider :: IO FloatRangeSlider
|
||||
@ -43,12 +44,12 @@ mkFloatRangeSlider = do
|
||||
dstyle <- mkDescriptionStyle
|
||||
|
||||
let boundedFloatAttrs = defaultBoundedFloatRangeWidget "FloatRangeSliderView" "FloatRangeSliderModel" layout $ StyleWidget dstyle
|
||||
sliderAttrs = (StepFloat =:: Just 0.1)
|
||||
:& (Orientation =:: HorizontalOrientation)
|
||||
:& (ReadOut =:: True)
|
||||
:& (ReadOutFormat =:: ".2f")
|
||||
:& (ContinuousUpdate =:: True)
|
||||
:& (Disabled =:: False)
|
||||
sliderAttrs = (F @StepFloat =:: Just 0.1)
|
||||
:& (F @Orientation =:: HorizontalOrientation)
|
||||
:& (F @ReadOut =:: True)
|
||||
:& (F @ReadOutFormat =:: ".2f")
|
||||
:& (F @ContinuousUpdate =:: True)
|
||||
:& (F @Disabled =:: False)
|
||||
:& RNil
|
||||
widgetState = WidgetState $ boundedFloatAttrs <+> sliderAttrs
|
||||
|
||||
@ -69,7 +70,7 @@ instance IHaskellWidget FloatRangeSlider where
|
||||
Just (Array values) ->
|
||||
case map (\(Number x) -> Sci.toRealFloat x) $ V.toList values of
|
||||
[x, y] -> do
|
||||
void $ setField' widget FloatPairValue (x, y)
|
||||
void $ setField' @FloatPairValue widget (x, y)
|
||||
triggerChange widget
|
||||
_ -> pure ()
|
||||
_ -> pure ()
|
||||
|
@ -2,6 +2,7 @@
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE DataKinds #-}
|
||||
{-# LANGUAGE TypeSynonymInstances #-}
|
||||
{-# LANGUAGE TypeApplications #-}
|
||||
|
||||
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
||||
|
||||
@ -31,7 +32,7 @@ import IHaskell.Display.Widgets.Layout.LayoutWidget
|
||||
import IHaskell.Display.Widgets.Style.DescriptionStyle
|
||||
|
||||
-- | 'FloatText' represents an FloatText widget from IPython.html.widgets.
|
||||
type FloatText = IPythonWidget 'FloatTextType
|
||||
type FloatText = IPythonWidget FloatTextType
|
||||
|
||||
-- | Create a new widget
|
||||
mkFloatText :: IO FloatText
|
||||
@ -42,9 +43,9 @@ mkFloatText = do
|
||||
dstyle <- mkDescriptionStyle
|
||||
|
||||
let floatAttrs = defaultFloatWidget "FloatTextView" "FloatTextModel" layout $ StyleWidget dstyle
|
||||
textAttrs = (Disabled =:: False)
|
||||
:& (ContinuousUpdate =:: False)
|
||||
:& (StepFloat =:: Nothing)
|
||||
textAttrs = (F @Disabled =:: False)
|
||||
:& (F @ContinuousUpdate =:: False)
|
||||
:& (F @StepFloat =:: Nothing)
|
||||
:& RNil
|
||||
widgetState = WidgetState $ floatAttrs <+> textAttrs
|
||||
|
||||
@ -63,6 +64,6 @@ instance IHaskellWidget FloatText where
|
||||
comm widget val _ =
|
||||
case nestedObjectLookup val ["state", "value"] of
|
||||
Just (Number value) -> do
|
||||
void $ setField' widget FloatValue (Sci.toRealFloat value)
|
||||
void $ setField' @FloatValue widget (Sci.toRealFloat value)
|
||||
triggerChange widget
|
||||
_ -> pure ()
|
||||
|
@ -2,6 +2,7 @@
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE DataKinds #-}
|
||||
{-# LANGUAGE TypeSynonymInstances #-}
|
||||
{-# LANGUAGE TypeApplications #-}
|
||||
|
||||
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
||||
|
||||
@ -31,7 +32,7 @@ import IHaskell.Display.Widgets.Layout.LayoutWidget
|
||||
import IHaskell.Display.Widgets.Style.DescriptionStyle
|
||||
|
||||
-- | 'BoundedIntText' represents an BoundedIntText widget from IPython.html.widgets.
|
||||
type BoundedIntText = IPythonWidget 'BoundedIntTextType
|
||||
type BoundedIntText = IPythonWidget BoundedIntTextType
|
||||
|
||||
-- | Create a new widget
|
||||
mkBoundedIntText :: IO BoundedIntText
|
||||
@ -42,9 +43,9 @@ mkBoundedIntText = do
|
||||
dstyle <- mkDescriptionStyle
|
||||
|
||||
let boundedIntAttrs = defaultBoundedIntWidget "IntTextView" "BoundedIntTextModel" layout $ StyleWidget dstyle
|
||||
textAttrs = (Disabled =:: False)
|
||||
:& (ContinuousUpdate =:: False)
|
||||
:& (StepInt =:: Just 1)
|
||||
textAttrs = (F @Disabled =:: False)
|
||||
:& (F @ContinuousUpdate =:: False)
|
||||
:& (F @StepInt =:: Just 1)
|
||||
:& RNil
|
||||
widgetState = WidgetState $ boundedIntAttrs <+> textAttrs
|
||||
|
||||
@ -63,6 +64,6 @@ instance IHaskellWidget BoundedIntText where
|
||||
comm widget val _ =
|
||||
case nestedObjectLookup val ["state", "value"] of
|
||||
Just (Number value) -> do
|
||||
void $ setField' widget IntValue (Sci.coefficient value)
|
||||
void $ setField' @IntValue widget (Sci.coefficient value)
|
||||
triggerChange widget
|
||||
_ -> pure ()
|
||||
|
@ -2,6 +2,7 @@
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE DataKinds #-}
|
||||
{-# LANGUAGE TypeSynonymInstances #-}
|
||||
{-# LANGUAGE TypeApplications #-}
|
||||
|
||||
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
||||
|
||||
@ -29,7 +30,7 @@ import IHaskell.Display.Widgets.Layout.LayoutWidget
|
||||
import IHaskell.Display.Widgets.Style.DescriptionStyle
|
||||
|
||||
-- | 'IntProgress' represents an IntProgress widget from IPython.html.widgets.
|
||||
type IntProgress = IPythonWidget 'IntProgressType
|
||||
type IntProgress = IPythonWidget IntProgressType
|
||||
|
||||
-- | Create a new widget
|
||||
mkIntProgress :: IO IntProgress
|
||||
@ -40,8 +41,8 @@ mkIntProgress = do
|
||||
dstyle <- mkDescriptionStyle
|
||||
|
||||
let boundedIntAttrs = defaultBoundedIntWidget "ProgressView" "IntProgressModel" layout $ StyleWidget dstyle
|
||||
progressAttrs = (Orientation =:: HorizontalOrientation)
|
||||
:& (BarStyle =:: DefaultBar)
|
||||
progressAttrs = (F @Orientation =:: HorizontalOrientation)
|
||||
:& (F @BarStyle =:: DefaultBar)
|
||||
:& RNil
|
||||
widgetState = WidgetState $ boundedIntAttrs <+> progressAttrs
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE DataKinds #-}
|
||||
{-# LANGUAGE TypeSynonymInstances #-}
|
||||
{-# LANGUAGE TypeApplications #-}
|
||||
|
||||
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
||||
|
||||
@ -31,7 +32,7 @@ import IHaskell.Display.Widgets.Layout.LayoutWidget
|
||||
import IHaskell.Display.Widgets.Style.DescriptionStyle
|
||||
|
||||
-- | 'IntSlider' represents an IntSlider widget from IPython.html.widgets.
|
||||
type IntSlider = IPythonWidget 'IntSliderType
|
||||
type IntSlider = IPythonWidget IntSliderType
|
||||
|
||||
-- | Create a new widget
|
||||
mkIntSlider :: IO IntSlider
|
||||
@ -42,12 +43,12 @@ mkIntSlider = do
|
||||
dstyle <- mkDescriptionStyle
|
||||
|
||||
let boundedIntAttrs = defaultBoundedIntWidget "IntSliderView" "IntSliderModel" layout $ StyleWidget dstyle
|
||||
sliderAttrs = (StepInt =:: Just 1)
|
||||
:& (Orientation =:: HorizontalOrientation)
|
||||
:& (ReadOut =:: True)
|
||||
:& (ReadOutFormat =:: "d")
|
||||
:& (ContinuousUpdate =:: True)
|
||||
:& (Disabled =:: False)
|
||||
sliderAttrs = (F @StepInt =:: Just 1)
|
||||
:& (F @Orientation =:: HorizontalOrientation)
|
||||
:& (F @ReadOut =:: True)
|
||||
:& (F @ReadOutFormat =:: "d")
|
||||
:& (F @ContinuousUpdate =:: True)
|
||||
:& (F @Disabled =:: False)
|
||||
:& RNil
|
||||
widgetState = WidgetState $ boundedIntAttrs <+> sliderAttrs
|
||||
|
||||
@ -66,6 +67,6 @@ instance IHaskellWidget IntSlider where
|
||||
comm widget val _ =
|
||||
case nestedObjectLookup val ["state", "value"] of
|
||||
Just (Number value) -> do
|
||||
void $ setField' widget IntValue (Sci.coefficient value)
|
||||
void $ setField' @IntValue widget (Sci.coefficient value)
|
||||
triggerChange widget
|
||||
_ -> pure ()
|
||||
|
@ -2,6 +2,7 @@
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE DataKinds #-}
|
||||
{-# LANGUAGE TypeSynonymInstances #-}
|
||||
{-# LANGUAGE TypeApplications #-}
|
||||
|
||||
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
||||
|
||||
@ -31,7 +32,7 @@ import IHaskell.Display.Widgets.Layout.LayoutWidget
|
||||
import IHaskell.Display.Widgets.Style.DescriptionStyle
|
||||
|
||||
-- | 'Play' represents an Play widget from IPython.html.widgets.
|
||||
type Play = IPythonWidget 'PlayType
|
||||
type Play = IPythonWidget PlayType
|
||||
|
||||
-- | Create a new widget
|
||||
mkPlay :: IO Play
|
||||
@ -42,12 +43,12 @@ mkPlay = do
|
||||
dstyle <- mkDescriptionStyle
|
||||
|
||||
let boundedIntAttrs = defaultBoundedIntWidget "PlayView" "PlayModel" layout $ StyleWidget dstyle
|
||||
playAttrs = (Playing =:: True)
|
||||
:& (Repeat =:: True)
|
||||
:& (Interval =:: 100)
|
||||
:& (StepInt =:: Just 1)
|
||||
:& (Disabled =:: False)
|
||||
:& (ShowRepeat =:: True)
|
||||
playAttrs = (F @Playing =:: True)
|
||||
:& (F @Repeat =:: True)
|
||||
:& (F @Interval =:: 100)
|
||||
:& (F @StepInt =:: Just 1)
|
||||
:& (F @Disabled =:: False)
|
||||
:& (F @ShowRepeat =:: True)
|
||||
:& RNil
|
||||
widgetState = WidgetState $ boundedIntAttrs <+> playAttrs
|
||||
|
||||
@ -66,6 +67,6 @@ instance IHaskellWidget Play where
|
||||
comm widget val _ =
|
||||
case nestedObjectLookup val ["state", "value"] of
|
||||
Just (Number value) -> do
|
||||
void $ setField' widget IntValue (Sci.coefficient value)
|
||||
void $ setField' @IntValue widget (Sci.coefficient value)
|
||||
triggerChange widget
|
||||
_ -> pure ()
|
||||
|
@ -2,6 +2,7 @@
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE DataKinds #-}
|
||||
{-# LANGUAGE TypeSynonymInstances #-}
|
||||
{-# LANGUAGE TypeApplications #-}
|
||||
|
||||
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
||||
|
||||
@ -32,7 +33,7 @@ import IHaskell.Display.Widgets.Layout.LayoutWidget
|
||||
import IHaskell.Display.Widgets.Style.DescriptionStyle
|
||||
|
||||
-- | 'IntRangeSlider' represents an IntRangeSlider widget from IPython.html.widgets.
|
||||
type IntRangeSlider = IPythonWidget 'IntRangeSliderType
|
||||
type IntRangeSlider = IPythonWidget IntRangeSliderType
|
||||
|
||||
-- | Create a new widget
|
||||
mkIntRangeSlider :: IO IntRangeSlider
|
||||
@ -43,12 +44,12 @@ mkIntRangeSlider = do
|
||||
dstyle <- mkDescriptionStyle
|
||||
|
||||
let boundedIntAttrs = defaultBoundedIntRangeWidget "IntRangeSliderView" "IntRangeSliderModel" layout $ StyleWidget dstyle
|
||||
sliderAttrs = (StepInt =:: Just 1)
|
||||
:& (Orientation =:: HorizontalOrientation)
|
||||
:& (ReadOut =:: True)
|
||||
:& (ReadOutFormat =:: "d")
|
||||
:& (ContinuousUpdate =:: True)
|
||||
:& (Disabled =:: False)
|
||||
sliderAttrs = (F @StepInt =:: Just 1)
|
||||
:& (F @Orientation =:: HorizontalOrientation)
|
||||
:& (F @ReadOut =:: True)
|
||||
:& (F @ReadOutFormat =:: "d")
|
||||
:& (F @ContinuousUpdate =:: True)
|
||||
:& (F @Disabled =:: False)
|
||||
:& RNil
|
||||
widgetState = WidgetState $ boundedIntAttrs <+> sliderAttrs
|
||||
|
||||
@ -69,7 +70,7 @@ instance IHaskellWidget IntRangeSlider where
|
||||
Just (Array values) ->
|
||||
case map (\(Number x) -> Sci.coefficient x) $ V.toList values of
|
||||
[x, y] -> do
|
||||
void $ setField' widget IntPairValue (x, y)
|
||||
void $ setField' @IntPairValue widget (x, y)
|
||||
triggerChange widget
|
||||
_ -> pure ()
|
||||
_ -> pure ()
|
||||
|
@ -2,6 +2,7 @@
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE DataKinds #-}
|
||||
{-# LANGUAGE TypeSynonymInstances #-}
|
||||
{-# LANGUAGE TypeApplications #-}
|
||||
|
||||
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
||||
|
||||
@ -31,7 +32,7 @@ import IHaskell.Display.Widgets.Layout.LayoutWidget
|
||||
import IHaskell.Display.Widgets.Style.DescriptionStyle
|
||||
|
||||
-- | 'IntText' represents an IntText widget from IPython.html.widgets.
|
||||
type IntText = IPythonWidget 'IntTextType
|
||||
type IntText = IPythonWidget IntTextType
|
||||
|
||||
-- | Create a new widget
|
||||
mkIntText :: IO IntText
|
||||
@ -42,9 +43,9 @@ mkIntText = do
|
||||
dstyle <- mkDescriptionStyle
|
||||
|
||||
let intAttrs = defaultIntWidget "IntTextView" "IntTextModel" layout $ StyleWidget dstyle
|
||||
textAttrs = (Disabled =:: False)
|
||||
:& (ContinuousUpdate =:: False)
|
||||
:& (StepInt =:: Just 1)
|
||||
textAttrs = (F @Disabled =:: False)
|
||||
:& (F @ContinuousUpdate =:: False)
|
||||
:& (F @StepInt =:: Just 1)
|
||||
:& RNil
|
||||
widgetState = WidgetState $ intAttrs <+> textAttrs
|
||||
|
||||
@ -63,6 +64,6 @@ instance IHaskellWidget IntText where
|
||||
comm widget val _ =
|
||||
case nestedObjectLookup val ["state", "value"] of
|
||||
Just (Number value) -> do
|
||||
void $ setField' widget IntValue (Sci.coefficient value)
|
||||
void $ setField' @IntValue widget (Sci.coefficient value)
|
||||
triggerChange widget
|
||||
_ -> pure ()
|
||||
|
@ -8,6 +8,9 @@
|
||||
{-# LANGUAGE UndecidableInstances #-}
|
||||
{-# LANGUAGE UndecidableSuperClasses #-}
|
||||
{-# LANGUAGE PolyKinds #-}
|
||||
{-# LANGUAGE RankNTypes #-}
|
||||
{-# LANGUAGE ScopedTypeVariables #-}
|
||||
{-# LANGUAGE TypeApplications #-}
|
||||
|
||||
module IHaskell.Display.Widgets.Interactive
|
||||
( interactive
|
||||
@ -34,7 +37,7 @@ import IHaskell.Display
|
||||
|
||||
import IHaskell.Display.Widgets.Types
|
||||
import IHaskell.Display.Widgets.Common
|
||||
import qualified IHaskell.Display.Widgets.Singletons as S (SField, Field(..))
|
||||
import qualified IHaskell.Display.Widgets.Singletons as S
|
||||
|
||||
import IHaskell.Display.Widgets.Box.Box
|
||||
import IHaskell.Display.Widgets.Bool.CheckBox
|
||||
@ -170,74 +173,73 @@ liftToWidgets func rc initvals = do
|
||||
|
||||
-- Set children for the Box
|
||||
let children = mkChildren widgets
|
||||
setField bx Children $ children ++ [ChildWidget out]
|
||||
setField @Children bx $ children ++ [ChildWidget out]
|
||||
|
||||
return bx
|
||||
|
||||
|
||||
data WrappedWidget w h f a where
|
||||
WrappedWidget ::
|
||||
(FieldType h ~ IO (), FieldType f ~ a, h ∈ WidgetFields w,
|
||||
f ∈ WidgetFields w, ToPairs (Attr h),
|
||||
forall h f w a. (FieldType h ~ IO (), FieldType f ~ a, h ∈ WidgetFields w,
|
||||
f ∈ WidgetFields w, ToPairs (Attr h), ToKey h,
|
||||
IHaskellWidget (IPythonWidget w), ToPairs (Attr f)) =>
|
||||
IO (IPythonWidget w) ->
|
||||
S.SField h -> S.SField f -> WrappedWidget w h f a
|
||||
IO (IPythonWidget w) -> WrappedWidget w h f a
|
||||
|
||||
construct :: WrappedWidget w h f a -> IO (IPythonWidget w)
|
||||
construct (WrappedWidget cs _ _) = cs
|
||||
construct (WrappedWidget cs) = cs
|
||||
|
||||
getValue :: WrappedWidget w h f a -> IPythonWidget w -> IO a
|
||||
getValue (WrappedWidget _ _ field) widget = getField widget field
|
||||
getValue :: forall w h f a. WrappedWidget w h f a -> IPythonWidget w -> IO a
|
||||
getValue (WrappedWidget _) widget = getField @f widget
|
||||
|
||||
setEvent :: WrappedWidget w h f a -> IPythonWidget w -> IO () -> IO ()
|
||||
setEvent (WrappedWidget _ h _) widget = setField widget h
|
||||
setEvent :: forall w h f a. WrappedWidget w h f a -> IPythonWidget w -> IO () -> IO ()
|
||||
setEvent (WrappedWidget _) widget = setField @h widget
|
||||
|
||||
class RecAll Attr (WidgetFields (SuitableWidget a)) ToPairs => FromWidget a where
|
||||
type SuitableWidget a :: WidgetType
|
||||
type SuitableHandler a :: S.Field
|
||||
type SuitableField a :: S.Field
|
||||
type SuitableWidget a
|
||||
type SuitableHandler a
|
||||
type SuitableField a
|
||||
data Argument a
|
||||
initializer :: IPythonWidget (SuitableWidget a) -> Argument a -> IO ()
|
||||
wrapped :: WrappedWidget (SuitableWidget a) (SuitableHandler a) (SuitableField a) a
|
||||
|
||||
instance FromWidget Bool where
|
||||
type SuitableWidget Bool = 'CheckBoxType
|
||||
type SuitableHandler Bool = 'S.ChangeHandler
|
||||
type SuitableField Bool = 'S.BoolValue
|
||||
type SuitableWidget Bool = CheckBoxType
|
||||
type SuitableHandler Bool = S.ChangeHandler
|
||||
type SuitableField Bool = S.BoolValue
|
||||
data Argument Bool = BoolVal Bool
|
||||
initializer w (BoolVal b) = setField w BoolValue b
|
||||
wrapped = WrappedWidget mkCheckBox ChangeHandler BoolValue
|
||||
initializer w (BoolVal b) = setField @BoolValue w b
|
||||
wrapped = WrappedWidget @ChangeHandler @BoolValue mkCheckBox
|
||||
|
||||
instance FromWidget Text where
|
||||
type SuitableWidget Text = 'TextType
|
||||
type SuitableHandler Text = 'S.SubmitHandler
|
||||
type SuitableField Text = 'S.StringValue
|
||||
type SuitableWidget Text = TextType
|
||||
type SuitableHandler Text = S.SubmitHandler
|
||||
type SuitableField Text = S.StringValue
|
||||
data Argument Text = TextVal Text
|
||||
initializer w (TextVal txt) = setField w StringValue txt
|
||||
wrapped = WrappedWidget mkText SubmitHandler StringValue
|
||||
initializer w (TextVal txt) = setField @StringValue w txt
|
||||
wrapped = WrappedWidget @SubmitHandler @StringValue mkText
|
||||
|
||||
instance FromWidget Integer where
|
||||
type SuitableWidget Integer = 'IntSliderType
|
||||
type SuitableHandler Integer = 'S.ChangeHandler
|
||||
type SuitableField Integer = 'S.IntValue
|
||||
type SuitableWidget Integer = IntSliderType
|
||||
type SuitableHandler Integer = S.ChangeHandler
|
||||
type SuitableField Integer = S.IntValue
|
||||
data Argument Integer = IntVal Integer
|
||||
| IntRange (Integer, Integer, Integer)
|
||||
wrapped = WrappedWidget mkIntSlider ChangeHandler IntValue
|
||||
initializer w (IntVal int) = setField w IntValue int
|
||||
wrapped = WrappedWidget @ChangeHandler @IntValue mkIntSlider
|
||||
initializer w (IntVal int) = setField @IntValue w int
|
||||
initializer w (IntRange (v, l, u)) = do
|
||||
setField w IntValue v
|
||||
setField w MinInt l
|
||||
setField w MaxInt u
|
||||
setField @IntValue w v
|
||||
setField @MinInt w l
|
||||
setField @MaxInt w u
|
||||
|
||||
instance FromWidget Double where
|
||||
type SuitableWidget Double = 'FloatSliderType
|
||||
type SuitableHandler Double = 'S.ChangeHandler
|
||||
type SuitableField Double = 'S.FloatValue
|
||||
type SuitableWidget Double = FloatSliderType
|
||||
type SuitableHandler Double = S.ChangeHandler
|
||||
type SuitableField Double = S.FloatValue
|
||||
data Argument Double = FloatVal Double
|
||||
| FloatRange (Double, Double, Double)
|
||||
wrapped = WrappedWidget mkFloatSlider ChangeHandler FloatValue
|
||||
initializer w (FloatVal d) = setField w FloatValue d
|
||||
wrapped = WrappedWidget @ChangeHandler @FloatValue mkFloatSlider
|
||||
initializer w (FloatVal d) = setField @FloatValue w d
|
||||
initializer w (FloatRange (v, l, u)) = do
|
||||
setField w FloatValue v
|
||||
setField w MinFloat l
|
||||
setField w MaxFloat u
|
||||
setField @FloatValue w v
|
||||
setField @MinFloat w l
|
||||
setField @MaxFloat w u
|
||||
|
@ -15,45 +15,45 @@ module IHaskell.Display.Widgets.Layout.Common where
|
||||
|
||||
import qualified IHaskell.Display.Widgets.Singletons as S
|
||||
|
||||
pattern AlignContent = S.SLAlignContent
|
||||
pattern AlignItems = S.SLAlignItems
|
||||
pattern AlignSelf = S.SLAlignSelf
|
||||
pattern BorderBottom = S.SLBorderBottom
|
||||
pattern BorderLeft = S.SLBorderLeft
|
||||
pattern BorderRight = S.SLBorderRight
|
||||
pattern BorderTop = S.SLBorderTop
|
||||
pattern Bottom = S.SLBottom
|
||||
pattern Display = S.SLDisplay
|
||||
pattern Flex = S.SLFlex
|
||||
pattern FlexFlow = S.SLFlexFlow
|
||||
pattern GridArea = S.SLGridArea
|
||||
pattern GridAutoColumns = S.SLGridAutoColumns
|
||||
pattern GridAutoFlow = S.SLGridAutoFlow
|
||||
pattern GridAutoRows = S.SLGridAutoRows
|
||||
pattern GridColumn = S.SLGridColumn
|
||||
pattern GridGap = S.SLGridGap
|
||||
pattern GridRow = S.SLGridRow
|
||||
pattern GridTemplateAreas = S.SLGridTemplateAreas
|
||||
pattern GridTemplateColumns = S.SLGridTemplateColumns
|
||||
pattern GridTemplateRows = S.SLGridTemplateRows
|
||||
pattern Height = S.SLHeight
|
||||
pattern JustifyContent = S.SLJustifyContent
|
||||
pattern JustifyItems = S.SLJustifyItems
|
||||
pattern Left = S.SLLeft
|
||||
pattern Margin = S.SLMargin
|
||||
pattern MaxHeight = S.SLMaxHeight
|
||||
pattern MaxWidth = S.SLMaxWidth
|
||||
pattern MinHeight = S.SLMinHeight
|
||||
pattern MinWidth = S.SLMinWidth
|
||||
pattern ObjectFit = S.SLObjectFit
|
||||
pattern ObjectPosition = S.SLObjectPosition
|
||||
pattern Order = S.SLOrder
|
||||
pattern Overflow = S.SLOverflow
|
||||
pattern Padding = S.SLPadding
|
||||
pattern Right = S.SLRight
|
||||
pattern Top = S.SLTop
|
||||
pattern Visibility = S.SLVisibility
|
||||
pattern Width = S.SLWidth
|
||||
type AlignContent = S.LAlignContent
|
||||
type AlignItems = S.LAlignItems
|
||||
type AlignSelf = S.LAlignSelf
|
||||
type BorderBottom = S.LBorderBottom
|
||||
type BorderLeft = S.LBorderLeft
|
||||
type BorderRight = S.LBorderRight
|
||||
type BorderTop = S.LBorderTop
|
||||
type Bottom = S.LBottom
|
||||
type Display = S.LDisplay
|
||||
type Flex = S.LFlex
|
||||
type FlexFlow = S.LFlexFlow
|
||||
type GridArea = S.LGridArea
|
||||
type GridAutoColumns = S.LGridAutoColumns
|
||||
type GridAutoFlow = S.LGridAutoFlow
|
||||
type GridAutoRows = S.LGridAutoRows
|
||||
type GridColumn = S.LGridColumn
|
||||
type GridGap = S.LGridGap
|
||||
type GridRow = S.LGridRow
|
||||
type GridTemplateAreas = S.LGridTemplateAreas
|
||||
type GridTemplateColumns = S.LGridTemplateColumns
|
||||
type GridTemplateRows = S.LGridTemplateRows
|
||||
type Height = S.LHeight
|
||||
type JustifyContent = S.LJustifyContent
|
||||
type JustifyItems = S.LJustifyItems
|
||||
type Left = S.LLeft
|
||||
type Margin = S.LMargin
|
||||
type MaxHeight = S.LMaxHeight
|
||||
type MaxWidth = S.LMaxWidth
|
||||
type MinHeight = S.LMinHeight
|
||||
type MinWidth = S.LMinWidth
|
||||
type ObjectFit = S.LObjectFit
|
||||
type ObjectPosition = S.LObjectPosition
|
||||
type Order = S.LOrder
|
||||
type Overflow = S.LOverflow
|
||||
type Padding = S.LPadding
|
||||
type Right = S.LRight
|
||||
type Top = S.LTop
|
||||
type Visibility = S.LVisibility
|
||||
type Width = S.LWidth
|
||||
|
||||
-- TODO: This should be implemented with static type checking, so it's
|
||||
-- easier to verify at compile-time. "The Haskell Way".
|
||||
|
@ -26,7 +26,7 @@ import IHaskell.Display.Widgets.Types
|
||||
import IHaskell.Display.Widgets.Layout.Types
|
||||
|
||||
-- | A 'Layout' represents a Layout from IPython.html.widgets.
|
||||
type Layout = IPythonWidget 'LayoutType
|
||||
type Layout = IPythonWidget LayoutType
|
||||
|
||||
-- | Create a new Layout
|
||||
mkLayout :: IO Layout
|
||||
@ -47,4 +47,4 @@ mkLayout = do
|
||||
return layout
|
||||
|
||||
instance IHaskellWidget Layout where
|
||||
getCommUUID = uuid
|
||||
getCommUUID = uuid
|
||||
|
@ -16,6 +16,7 @@
|
||||
{-# LANGUAGE AutoDeriveTypeable #-}
|
||||
{-# LANGUAGE CPP #-}
|
||||
{-# LANGUAGE FlexibleContexts #-}
|
||||
{-# LANGUAGE TypeApplications #-}
|
||||
|
||||
module IHaskell.Display.Widgets.Layout.Types where
|
||||
|
||||
@ -33,143 +34,143 @@ import IHaskell.Display.Widgets.Types
|
||||
|
||||
import IHaskell.Display.Widgets.Layout.Common
|
||||
|
||||
type LayoutClass = [ 'S.ModelModule
|
||||
, 'S.ModelModuleVersion
|
||||
, 'S.ModelName
|
||||
, 'S.ViewModule
|
||||
, 'S.ViewModuleVersion
|
||||
, 'S.ViewName
|
||||
, 'S.LAlignContent
|
||||
, 'S.LAlignItems
|
||||
, 'S.LAlignSelf
|
||||
, 'S.LBorderBottom
|
||||
, 'S.LBorderLeft
|
||||
, 'S.LBorderRight
|
||||
, 'S.LBorderTop
|
||||
, 'S.LBottom
|
||||
, 'S.LDisplay
|
||||
, 'S.LFlex
|
||||
, 'S.LFlexFlow
|
||||
, 'S.LGridArea
|
||||
, 'S.LGridAutoColumns
|
||||
, 'S.LGridAutoFlow
|
||||
, 'S.LGridAutoRows
|
||||
, 'S.LGridColumn
|
||||
, 'S.LGridGap
|
||||
, 'S.LGridRow
|
||||
, 'S.LGridTemplateAreas
|
||||
, 'S.LGridTemplateColumns
|
||||
, 'S.LGridTemplateRows
|
||||
, 'S.LHeight
|
||||
, 'S.LJustifyContent
|
||||
, 'S.LJustifyItems
|
||||
, 'S.LLeft
|
||||
, 'S.LMargin
|
||||
, 'S.LMaxHeight
|
||||
, 'S.LMaxWidth
|
||||
, 'S.LMinHeight
|
||||
, 'S.LMinWidth
|
||||
, 'S.LObjectFit
|
||||
, 'S.LObjectPosition
|
||||
, 'S.LOrder
|
||||
, 'S.LOverflow
|
||||
, 'S.LPadding
|
||||
, 'S.LRight
|
||||
, 'S.LTop
|
||||
, 'S.LVisibility
|
||||
, 'S.LWidth
|
||||
type LayoutClass = [ S.ModelModule
|
||||
, S.ModelModuleVersion
|
||||
, S.ModelName
|
||||
, S.ViewModule
|
||||
, S.ViewModuleVersion
|
||||
, S.ViewName
|
||||
, S.LAlignContent
|
||||
, S.LAlignItems
|
||||
, S.LAlignSelf
|
||||
, S.LBorderBottom
|
||||
, S.LBorderLeft
|
||||
, S.LBorderRight
|
||||
, S.LBorderTop
|
||||
, S.LBottom
|
||||
, S.LDisplay
|
||||
, S.LFlex
|
||||
, S.LFlexFlow
|
||||
, S.LGridArea
|
||||
, S.LGridAutoColumns
|
||||
, S.LGridAutoFlow
|
||||
, S.LGridAutoRows
|
||||
, S.LGridColumn
|
||||
, S.LGridGap
|
||||
, S.LGridRow
|
||||
, S.LGridTemplateAreas
|
||||
, S.LGridTemplateColumns
|
||||
, S.LGridTemplateRows
|
||||
, S.LHeight
|
||||
, S.LJustifyContent
|
||||
, S.LJustifyItems
|
||||
, S.LLeft
|
||||
, S.LMargin
|
||||
, S.LMaxHeight
|
||||
, S.LMaxWidth
|
||||
, S.LMinHeight
|
||||
, S.LMinWidth
|
||||
, S.LObjectFit
|
||||
, S.LObjectPosition
|
||||
, S.LOrder
|
||||
, S.LOverflow
|
||||
, S.LPadding
|
||||
, S.LRight
|
||||
, S.LTop
|
||||
, S.LVisibility
|
||||
, S.LWidth
|
||||
]
|
||||
|
||||
type instance FieldType 'S.LAlignContent = Maybe String
|
||||
type instance FieldType 'S.LAlignItems = Maybe String
|
||||
type instance FieldType 'S.LAlignSelf = Maybe String
|
||||
type instance FieldType 'S.LBorderBottom = Maybe String
|
||||
type instance FieldType 'S.LBorderLeft = Maybe String
|
||||
type instance FieldType 'S.LBorderRight = Maybe String
|
||||
type instance FieldType 'S.LBorderTop = Maybe String
|
||||
type instance FieldType 'S.LBottom = Maybe String
|
||||
type instance FieldType 'S.LDisplay = Maybe String
|
||||
type instance FieldType 'S.LFlex = Maybe String
|
||||
type instance FieldType 'S.LFlexFlow = Maybe String
|
||||
type instance FieldType 'S.LGridArea = Maybe String
|
||||
type instance FieldType 'S.LGridAutoColumns = Maybe String
|
||||
type instance FieldType 'S.LGridAutoFlow = Maybe String
|
||||
type instance FieldType 'S.LGridAutoRows = Maybe String
|
||||
type instance FieldType 'S.LGridColumn = Maybe String
|
||||
type instance FieldType 'S.LGridGap = Maybe String
|
||||
type instance FieldType 'S.LGridRow = Maybe String
|
||||
type instance FieldType 'S.LGridTemplateAreas = Maybe String
|
||||
type instance FieldType 'S.LGridTemplateColumns = Maybe String
|
||||
type instance FieldType 'S.LGridTemplateRows = Maybe String
|
||||
type instance FieldType 'S.LHeight = Maybe String
|
||||
type instance FieldType 'S.LJustifyContent = Maybe String
|
||||
type instance FieldType 'S.LJustifyItems = Maybe String
|
||||
type instance FieldType 'S.LLeft = Maybe String
|
||||
type instance FieldType 'S.LMargin = Maybe String
|
||||
type instance FieldType 'S.LMaxHeight = Maybe String
|
||||
type instance FieldType 'S.LMaxWidth = Maybe String
|
||||
type instance FieldType 'S.LMinHeight = Maybe String
|
||||
type instance FieldType 'S.LMinWidth = Maybe String
|
||||
type instance FieldType 'S.LObjectFit = Maybe String
|
||||
type instance FieldType 'S.LObjectPosition = Maybe String
|
||||
type instance FieldType 'S.LOrder = Maybe String
|
||||
type instance FieldType 'S.LOverflow = Maybe String
|
||||
type instance FieldType 'S.LPadding = Maybe String
|
||||
type instance FieldType 'S.LRight = Maybe String
|
||||
type instance FieldType 'S.LTop = Maybe String
|
||||
type instance FieldType 'S.LVisibility = Maybe String
|
||||
type instance FieldType 'S.LWidth = Maybe String
|
||||
type instance FieldType S.LAlignContent = Maybe String
|
||||
type instance FieldType S.LAlignItems = Maybe String
|
||||
type instance FieldType S.LAlignSelf = Maybe String
|
||||
type instance FieldType S.LBorderBottom = Maybe String
|
||||
type instance FieldType S.LBorderLeft = Maybe String
|
||||
type instance FieldType S.LBorderRight = Maybe String
|
||||
type instance FieldType S.LBorderTop = Maybe String
|
||||
type instance FieldType S.LBottom = Maybe String
|
||||
type instance FieldType S.LDisplay = Maybe String
|
||||
type instance FieldType S.LFlex = Maybe String
|
||||
type instance FieldType S.LFlexFlow = Maybe String
|
||||
type instance FieldType S.LGridArea = Maybe String
|
||||
type instance FieldType S.LGridAutoColumns = Maybe String
|
||||
type instance FieldType S.LGridAutoFlow = Maybe String
|
||||
type instance FieldType S.LGridAutoRows = Maybe String
|
||||
type instance FieldType S.LGridColumn = Maybe String
|
||||
type instance FieldType S.LGridGap = Maybe String
|
||||
type instance FieldType S.LGridRow = Maybe String
|
||||
type instance FieldType S.LGridTemplateAreas = Maybe String
|
||||
type instance FieldType S.LGridTemplateColumns = Maybe String
|
||||
type instance FieldType S.LGridTemplateRows = Maybe String
|
||||
type instance FieldType S.LHeight = Maybe String
|
||||
type instance FieldType S.LJustifyContent = Maybe String
|
||||
type instance FieldType S.LJustifyItems = Maybe String
|
||||
type instance FieldType S.LLeft = Maybe String
|
||||
type instance FieldType S.LMargin = Maybe String
|
||||
type instance FieldType S.LMaxHeight = Maybe String
|
||||
type instance FieldType S.LMaxWidth = Maybe String
|
||||
type instance FieldType S.LMinHeight = Maybe String
|
||||
type instance FieldType S.LMinWidth = Maybe String
|
||||
type instance FieldType S.LObjectFit = Maybe String
|
||||
type instance FieldType S.LObjectPosition = Maybe String
|
||||
type instance FieldType S.LOrder = Maybe String
|
||||
type instance FieldType S.LOverflow = Maybe String
|
||||
type instance FieldType S.LPadding = Maybe String
|
||||
type instance FieldType S.LRight = Maybe String
|
||||
type instance FieldType S.LTop = Maybe String
|
||||
type instance FieldType S.LVisibility = Maybe String
|
||||
type instance FieldType S.LWidth = Maybe String
|
||||
|
||||
-- type family WidgetFields (w :: WidgetType) :: [Field] where
|
||||
type instance WidgetFields 'LayoutType = LayoutClass
|
||||
-- type family WidgetFields w :: [*] where
|
||||
type instance WidgetFields LayoutType = LayoutClass
|
||||
|
||||
-- | A record representing a widget of the Layour class from IPython
|
||||
defaultLayoutWidget :: Rec Attr LayoutClass
|
||||
defaultLayoutWidget = (S.SModelModule =:! "@jupyter-widgets/base")
|
||||
:& (S.SModelModuleVersion =:! "2.0.0")
|
||||
:& (S.SModelName =:! "LayoutModel")
|
||||
:& (S.SViewModule =:! "@jupyter-widgets/base")
|
||||
:& (S.SViewModuleVersion =:! "2.0.0")
|
||||
:& (S.SViewName =:! "LayoutView")
|
||||
:& (AlignContent =:. (Nothing, venum alignContentProps))
|
||||
:& (AlignItems =:. (Nothing, venum alignItemProps))
|
||||
:& (AlignSelf =:. (Nothing, venum alignSelfProps))
|
||||
:& (BorderBottom =:: Nothing)
|
||||
:& (BorderLeft =:: Nothing)
|
||||
:& (BorderRight =:: Nothing)
|
||||
:& (BorderTop =:: Nothing)
|
||||
:& (Bottom =:: Nothing)
|
||||
:& (Display =:: Nothing)
|
||||
:& (Flex =:: Nothing)
|
||||
:& (FlexFlow =:: Nothing)
|
||||
:& (GridArea =:: Nothing)
|
||||
:& (GridAutoColumns =:: Nothing)
|
||||
:& (GridAutoFlow =:. (Nothing, venum gridAutoFlowProps))
|
||||
:& (GridAutoRows =:: Nothing)
|
||||
:& (GridColumn =:: Nothing)
|
||||
:& (GridGap =:: Nothing)
|
||||
:& (GridRow =:: Nothing)
|
||||
:& (GridTemplateAreas =:: Nothing)
|
||||
:& (GridTemplateColumns =:: Nothing)
|
||||
:& (GridTemplateRows =:: Nothing)
|
||||
:& (Height =:: Nothing)
|
||||
:& (JustifyContent =:: Nothing)
|
||||
:& (JustifyItems =:: Nothing)
|
||||
:& (Left =:: Nothing)
|
||||
:& (Margin =:: Nothing)
|
||||
:& (MaxHeight =:: Nothing)
|
||||
:& (MaxWidth =:: Nothing)
|
||||
:& (MinHeight =:: Nothing)
|
||||
:& (MinWidth =:: Nothing)
|
||||
:& (ObjectFit =:: Nothing)
|
||||
:& (ObjectPosition =:: Nothing)
|
||||
:& (Order =:: Nothing)
|
||||
:& (Overflow =:. (Nothing, venum overflowProps))
|
||||
:& (Padding =:: Nothing)
|
||||
:& (Right =:: Nothing)
|
||||
:& (Top =:: Nothing)
|
||||
:& (Visibility =:. (Nothing, venum visibilityProps))
|
||||
:& (Width =:: Nothing)
|
||||
defaultLayoutWidget = ( F @S.ModelModule =:! "@jupyter-widgets/base")
|
||||
:& (F @S.ModelModuleVersion =:! "2.0.0")
|
||||
:& (F @S.ModelName =:! "LayoutModel")
|
||||
:& (F @S.ViewModule =:! "@jupyter-widgets/base")
|
||||
:& (F @S.ViewModuleVersion =:! "2.0.0")
|
||||
:& (F @S.ViewName =:! "LayoutView")
|
||||
:& (F @AlignContent =:. (Nothing, venum alignContentProps))
|
||||
:& (F @AlignItems =:. (Nothing, venum alignItemProps))
|
||||
:& (F @AlignSelf =:. (Nothing, venum alignSelfProps))
|
||||
:& (F @BorderBottom =:: Nothing)
|
||||
:& (F @BorderLeft =:: Nothing)
|
||||
:& (F @BorderRight =:: Nothing)
|
||||
:& (F @BorderTop =:: Nothing)
|
||||
:& (F @Bottom =:: Nothing)
|
||||
:& (F @Display =:: Nothing)
|
||||
:& (F @Flex =:: Nothing)
|
||||
:& (F @FlexFlow =:: Nothing)
|
||||
:& (F @GridArea =:: Nothing)
|
||||
:& (F @GridAutoColumns =:: Nothing)
|
||||
:& (F @GridAutoFlow =:. (Nothing, venum gridAutoFlowProps))
|
||||
:& (F @GridAutoRows =:: Nothing)
|
||||
:& (F @GridColumn =:: Nothing)
|
||||
:& (F @GridGap =:: Nothing)
|
||||
:& (F @GridRow =:: Nothing)
|
||||
:& (F @GridTemplateAreas =:: Nothing)
|
||||
:& (F @GridTemplateColumns =:: Nothing)
|
||||
:& (F @GridTemplateRows =:: Nothing)
|
||||
:& (F @Height =:: Nothing)
|
||||
:& (F @JustifyContent =:: Nothing)
|
||||
:& (F @JustifyItems =:: Nothing)
|
||||
:& (F @Left =:: Nothing)
|
||||
:& (F @Margin =:: Nothing)
|
||||
:& (F @MaxHeight =:: Nothing)
|
||||
:& (F @MaxWidth =:: Nothing)
|
||||
:& (F @MinHeight =:: Nothing)
|
||||
:& (F @MinWidth =:: Nothing)
|
||||
:& (F @ObjectFit =:: Nothing)
|
||||
:& (F @ObjectPosition =:: Nothing)
|
||||
:& (F @Order =:: Nothing)
|
||||
:& (F @Overflow =:. (Nothing, venum overflowProps))
|
||||
:& (F @Padding =:: Nothing)
|
||||
:& (F @Right =:: Nothing)
|
||||
:& (F @Top =:: Nothing)
|
||||
:& (F @Visibility =:. (Nothing, venum visibilityProps))
|
||||
:& (F @Width =:: Nothing)
|
||||
:& RNil
|
||||
where venum :: [String] -> Maybe String -> IO (Maybe String)
|
||||
venum _ Nothing = return Nothing
|
||||
|
@ -2,6 +2,7 @@
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE DataKinds #-}
|
||||
{-# LANGUAGE TypeSynonymInstances #-}
|
||||
{-# LANGUAGE TypeApplications #-}
|
||||
|
||||
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
||||
|
||||
@ -28,7 +29,7 @@ import IHaskell.Display.Widgets.Types
|
||||
import IHaskell.Display.Widgets.Common
|
||||
|
||||
-- | An 'DirectionalLink' represents a DirectionalLink widget from IPython.html.widgets.
|
||||
type DirectionalLink = IPythonWidget 'DirectionalLinkType
|
||||
type DirectionalLink = IPythonWidget DirectionalLinkType
|
||||
|
||||
-- | Create a new DirectionalLink widget
|
||||
mkDirectionalLink :: IO DirectionalLink
|
||||
@ -52,8 +53,8 @@ mkDirectionalLink = do
|
||||
jsdlink :: WidgetFieldPair -> WidgetFieldPair -> IO DirectionalLink
|
||||
jsdlink wfp1 wfp2 = do
|
||||
dlink <- mkDirectionalLink
|
||||
_ <- setField dlink Source wfp1
|
||||
_ <- setField dlink Target wfp2
|
||||
_ <- setField @Source dlink wfp1
|
||||
_ <- setField @Target dlink wfp2
|
||||
return dlink
|
||||
|
||||
instance IHaskellWidget DirectionalLink where
|
||||
|
@ -2,6 +2,7 @@
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE DataKinds #-}
|
||||
{-# LANGUAGE TypeSynonymInstances #-}
|
||||
{-# LANGUAGE TypeApplications #-}
|
||||
|
||||
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
||||
|
||||
@ -28,7 +29,7 @@ import IHaskell.Display.Widgets.Types
|
||||
import IHaskell.Display.Widgets.Common
|
||||
|
||||
-- | An 'Link' represents a Link widget from IPython.html.widgets.
|
||||
type Link = IPythonWidget 'LinkType
|
||||
type Link = IPythonWidget LinkType
|
||||
|
||||
-- | Create a new link widget
|
||||
mkLink :: IO Link
|
||||
@ -52,8 +53,8 @@ mkLink = do
|
||||
jslink :: WidgetFieldPair -> WidgetFieldPair -> IO Link
|
||||
jslink wfp1 wfp2 = do
|
||||
link <- mkLink
|
||||
_ <- setField link Source wfp1
|
||||
_ <- setField link Target wfp2
|
||||
_ <- setField @Source link wfp1
|
||||
_ <- setField @Target link wfp2
|
||||
return link
|
||||
|
||||
instance IHaskellWidget Link where
|
||||
|
@ -2,6 +2,7 @@
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE DataKinds #-}
|
||||
{-# LANGUAGE TypeSynonymInstances #-}
|
||||
{-# LANGUAGE TypeApplications #-}
|
||||
|
||||
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
||||
|
||||
@ -28,7 +29,7 @@ import IHaskell.Display.Widgets.Common
|
||||
import IHaskell.Display.Widgets.Layout.LayoutWidget
|
||||
|
||||
-- | An 'AudioWidget' represents a Audio widget from IPython.html.widgets.
|
||||
type AudioWidget = IPythonWidget 'AudioType
|
||||
type AudioWidget = IPythonWidget AudioType
|
||||
|
||||
-- | Create a new audio widget
|
||||
mkAudio :: IO AudioWidget
|
||||
@ -38,10 +39,10 @@ mkAudio = do
|
||||
layout <- mkLayout
|
||||
|
||||
let mediaAttrs = defaultMediaWidget "AudioView" "AudioModel" layout
|
||||
audioAttrs = (AudioFormat =:: MP3)
|
||||
:& (AutoPlay =:: True)
|
||||
:& (Loop =:: True)
|
||||
:& (Controls =:: True)
|
||||
audioAttrs = (F @AudioFormat =:: MP3)
|
||||
:& (F @AutoPlay =:: True)
|
||||
:& (F @Loop =:: True)
|
||||
:& (F @Controls =:: True)
|
||||
:& RNil
|
||||
widgetState = WidgetState (mediaAttrs <+> audioAttrs)
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE DataKinds #-}
|
||||
{-# LANGUAGE TypeSynonymInstances #-}
|
||||
{-# LANGUAGE TypeApplications #-}
|
||||
|
||||
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
||||
|
||||
@ -24,11 +25,11 @@ import IHaskell.Eval.Widgets
|
||||
import IHaskell.IPython.Message.UUID as U
|
||||
|
||||
import IHaskell.Display.Widgets.Types
|
||||
import IHaskell.Display.Widgets.Common
|
||||
import IHaskell.Display.Widgets.Common as C
|
||||
import IHaskell.Display.Widgets.Layout.LayoutWidget
|
||||
|
||||
-- | An 'ImageWidget' represents a Image widget from IPython.html.widgets.
|
||||
type ImageWidget = IPythonWidget 'ImageType
|
||||
type ImageWidget = IPythonWidget ImageType
|
||||
|
||||
-- | Create a new image widget
|
||||
mkImage :: IO ImageWidget
|
||||
@ -38,9 +39,9 @@ mkImage = do
|
||||
layout <- mkLayout
|
||||
|
||||
let mediaAttrs = defaultMediaWidget "ImageView" "ImageModel" layout
|
||||
imageAttrs = (ImageFormat =:: PNG)
|
||||
:& (Width =:+ 0)
|
||||
:& (Height =:+ 0)
|
||||
imageAttrs = (F @ImageFormat =:: PNG)
|
||||
:& (F @C.Width =:+ 0)
|
||||
:& (F @C.Height =:+ 0)
|
||||
:& RNil
|
||||
widgetState = WidgetState (mediaAttrs <+> imageAttrs)
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE DataKinds #-}
|
||||
{-# LANGUAGE TypeSynonymInstances #-}
|
||||
{-# LANGUAGE TypeApplications #-}
|
||||
|
||||
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
||||
|
||||
@ -24,11 +25,11 @@ import IHaskell.Eval.Widgets
|
||||
import IHaskell.IPython.Message.UUID as U
|
||||
|
||||
import IHaskell.Display.Widgets.Types
|
||||
import IHaskell.Display.Widgets.Common
|
||||
import IHaskell.Display.Widgets.Common as C
|
||||
import IHaskell.Display.Widgets.Layout.LayoutWidget
|
||||
|
||||
-- | An 'VideoWidget' represents a video widget from IPython.html.widgets.
|
||||
type VideoWidget = IPythonWidget 'VideoType
|
||||
type VideoWidget = IPythonWidget VideoType
|
||||
|
||||
-- | Create a new video widget
|
||||
mkVideo :: IO VideoWidget
|
||||
@ -38,12 +39,12 @@ mkVideo = do
|
||||
layout <- mkLayout
|
||||
|
||||
let mediaAttrs = defaultMediaWidget "VideoView" "VideoModel" layout
|
||||
videoAttrs = (VideoFormat =:: MP4)
|
||||
:& (Width =:+ 0)
|
||||
:& (Height =:+ 0)
|
||||
:& (AutoPlay =:: True)
|
||||
:& (Loop =:: True)
|
||||
:& (Controls =:: True)
|
||||
videoAttrs = (F @VideoFormat =:: MP4)
|
||||
:& (F @C.Width =:+ 0)
|
||||
:& (F @C.Height =:+ 0)
|
||||
:& (F @AutoPlay =:: True)
|
||||
:& (F @Loop =:: True)
|
||||
:& (F @Controls =:: True)
|
||||
:& RNil
|
||||
widgetState = WidgetState (mediaAttrs <+> videoAttrs)
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE DataKinds #-}
|
||||
{-# LANGUAGE TypeSynonymInstances #-}
|
||||
{-# LANGUAGE TypeApplications #-}
|
||||
|
||||
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
||||
|
||||
@ -37,7 +38,7 @@ import IHaskell.Display.Widgets.Common
|
||||
import IHaskell.Display.Widgets.Layout.LayoutWidget
|
||||
|
||||
-- | An 'OutputWidget' represents a Output widget from IPython.html.widgets.
|
||||
type OutputWidget = IPythonWidget 'OutputType
|
||||
type OutputWidget = IPythonWidget OutputType
|
||||
|
||||
-- | Create a new output widget
|
||||
mkOutput :: IO OutputWidget
|
||||
@ -47,12 +48,12 @@ mkOutput = do
|
||||
layout <- mkLayout
|
||||
|
||||
let domAttrs = defaultDOMWidget "OutputView" "OutputModel" layout
|
||||
outAttrs = (ViewModule =:! "@jupyter-widgets/output")
|
||||
:& (ModelModule =:! "@jupyter-widgets/output")
|
||||
:& (ViewModuleVersion =:! "1.0.0")
|
||||
:& (ModelModuleVersion =:! "1.0.0")
|
||||
:& (MsgID =:: "")
|
||||
:& (Outputs =:: [])
|
||||
outAttrs = (F @ViewModule =:! "@jupyter-widgets/output")
|
||||
:& (F @ModelModule =:! "@jupyter-widgets/output")
|
||||
:& (F @ViewModuleVersion =:! "1.0.0")
|
||||
:& (F @ModelModuleVersion =:! "1.0.0")
|
||||
:& (F @MsgID =:: "")
|
||||
:& (F @Outputs =:: [])
|
||||
:& RNil
|
||||
widgetState = WidgetState $ domAttrs <+> outAttrs
|
||||
|
||||
@ -69,7 +70,7 @@ mkOutput = do
|
||||
-- | Appends the Text to the given Stream
|
||||
appendStd :: StreamType -> OutputWidget -> Text -> IO ()
|
||||
appendStd n out t = do
|
||||
getField out Outputs >>= setField out Outputs . updateOutputs
|
||||
getField @Outputs out >>= setField @Outputs out . updateOutputs
|
||||
where updateOutputs :: [OutputMsg] -> [OutputMsg]
|
||||
updateOutputs = (++[OutputStream n t])
|
||||
|
||||
@ -84,16 +85,16 @@ appendStderr = appendStd Stderr
|
||||
-- | Clears the output widget
|
||||
clearOutput' :: OutputWidget -> IO ()
|
||||
clearOutput' w = do
|
||||
_ <- setField w Outputs []
|
||||
_ <- setField w MsgID ""
|
||||
_ <- setField @Outputs w []
|
||||
_ <- setField @MsgID w ""
|
||||
return ()
|
||||
|
||||
-- | Appends anything displayable to an output widget
|
||||
appendDisplay :: IHaskellDisplay a => OutputWidget -> a -> IO ()
|
||||
appendDisplay o d = do
|
||||
outputs <- getField o Outputs
|
||||
outputs <- getField @Outputs o
|
||||
disp <- display d
|
||||
_ <- setField o Outputs $ outputs ++ [OutputData disp]
|
||||
_ <- setField @Outputs o $ outputs ++ [OutputData disp]
|
||||
return ()
|
||||
|
||||
-- | Clear the output widget immediately
|
||||
@ -108,7 +109,7 @@ clearOutput_ widget = widgetClearOutput True >> clearOutput' widget
|
||||
replaceOutput :: IHaskellDisplay a => OutputWidget -> a -> IO ()
|
||||
replaceOutput widget d = do
|
||||
disp <- display d
|
||||
setField widget Outputs [OutputData disp]
|
||||
setField @Outputs widget [OutputData disp]
|
||||
|
||||
instance IHaskellWidget OutputWidget where
|
||||
getCommUUID = uuid
|
||||
|
@ -2,6 +2,7 @@
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE DataKinds #-}
|
||||
{-# LANGUAGE TypeSynonymInstances #-}
|
||||
{-# LANGUAGE TypeApplications #-}
|
||||
|
||||
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
||||
|
||||
@ -30,7 +31,7 @@ import IHaskell.Display.Widgets.Layout.LayoutWidget
|
||||
import IHaskell.Display.Widgets.Style.DescriptionStyle
|
||||
|
||||
-- | A 'Dropdown' represents a Dropdown widget from IPython.html.widgets.
|
||||
type Dropdown = IPythonWidget 'DropdownType
|
||||
type Dropdown = IPythonWidget DropdownType
|
||||
|
||||
-- | Create a new Dropdown widget
|
||||
mkDropdown :: IO Dropdown
|
||||
@ -57,6 +58,6 @@ instance IHaskellWidget Dropdown where
|
||||
comm widget val _ =
|
||||
case nestedObjectLookup val ["state", "index"] of
|
||||
Just (Number index) -> do
|
||||
void $ setField' widget OptionalIndex (Just $ Sci.coefficient index)
|
||||
void $ setField' @OptionalIndex widget (Just $ Sci.coefficient index)
|
||||
triggerSelection widget
|
||||
_ -> pure ()
|
||||
|
@ -2,6 +2,7 @@
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE DataKinds #-}
|
||||
{-# LANGUAGE TypeSynonymInstances #-}
|
||||
{-# LANGUAGE TypeApplications #-}
|
||||
|
||||
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
||||
|
||||
@ -30,7 +31,7 @@ import IHaskell.Display.Widgets.Layout.LayoutWidget
|
||||
import IHaskell.Display.Widgets.Style.DescriptionStyle
|
||||
|
||||
-- | A 'RadioButtons' represents a RadioButtons widget from IPython.html.widgets.
|
||||
type RadioButtons = IPythonWidget 'RadioButtonsType
|
||||
type RadioButtons = IPythonWidget RadioButtonsType
|
||||
|
||||
-- | Create a new RadioButtons widget
|
||||
mkRadioButtons :: IO RadioButtons
|
||||
@ -57,6 +58,6 @@ instance IHaskellWidget RadioButtons where
|
||||
comm widget val _ =
|
||||
case nestedObjectLookup val ["state", "index"] of
|
||||
Just (Number index) -> do
|
||||
void $ setField' widget OptionalIndex (Just $ Sci.coefficient index)
|
||||
void $ setField' @OptionalIndex widget (Just $ Sci.coefficient index)
|
||||
triggerSelection widget
|
||||
_ -> pure ()
|
||||
|
@ -2,6 +2,7 @@
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE DataKinds #-}
|
||||
{-# LANGUAGE TypeSynonymInstances #-}
|
||||
{-# LANGUAGE TypeApplications #-}
|
||||
|
||||
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
||||
|
||||
@ -31,7 +32,7 @@ import IHaskell.Display.Widgets.Layout.LayoutWidget
|
||||
import IHaskell.Display.Widgets.Style.DescriptionStyle
|
||||
|
||||
-- | A 'Select' represents a Select widget from IPython.html.widgets.
|
||||
type Select = IPythonWidget 'SelectType
|
||||
type Select = IPythonWidget SelectType
|
||||
|
||||
-- | Create a new Select widget
|
||||
mkSelect :: IO Select
|
||||
@ -42,7 +43,7 @@ mkSelect = do
|
||||
dstyle <- mkDescriptionStyle
|
||||
|
||||
let selectionAttrs = defaultSelectionWidget "SelectView" "SelectModel" layout $ StyleWidget dstyle
|
||||
selectAttrs = (Rows =:: Just 5)
|
||||
selectAttrs = (F @Rows =:: Just 5)
|
||||
:& RNil
|
||||
widgetState = WidgetState $ selectionAttrs <+> selectAttrs
|
||||
|
||||
@ -61,6 +62,6 @@ instance IHaskellWidget Select where
|
||||
comm widget val _ =
|
||||
case nestedObjectLookup val ["state", "index"] of
|
||||
Just (Number index) -> do
|
||||
void $ setField' widget OptionalIndex (Just $ Sci.coefficient index)
|
||||
void $ setField' @OptionalIndex widget (Just $ Sci.coefficient index)
|
||||
triggerSelection widget
|
||||
_ -> pure ()
|
||||
|
@ -2,6 +2,7 @@
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE DataKinds #-}
|
||||
{-# LANGUAGE TypeSynonymInstances #-}
|
||||
{-# LANGUAGE TypeApplications #-}
|
||||
|
||||
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
||||
|
||||
@ -32,7 +33,7 @@ import IHaskell.Display.Widgets.Layout.LayoutWidget
|
||||
import IHaskell.Display.Widgets.Style.DescriptionStyle
|
||||
|
||||
-- | A 'SelectMultiple' represents a SelectMultiple widget from IPython.html.widgets.
|
||||
type SelectMultiple = IPythonWidget 'SelectMultipleType
|
||||
type SelectMultiple = IPythonWidget SelectMultipleType
|
||||
|
||||
-- | Create a new SelectMultiple widget
|
||||
mkSelectMultiple :: IO SelectMultiple
|
||||
@ -43,7 +44,7 @@ mkSelectMultiple = do
|
||||
dstyle <- mkDescriptionStyle
|
||||
|
||||
let multipleSelectionAttrs = defaultMultipleSelectionWidget "SelectMultipleView" "SelectMultipleModel" layout $ StyleWidget dstyle
|
||||
selectMultipleAttrs = (Rows =:: Just 5)
|
||||
selectMultipleAttrs = (F @Rows =:: Just 5)
|
||||
:& RNil
|
||||
widgetState = WidgetState $ multipleSelectionAttrs <+> selectMultipleAttrs
|
||||
|
||||
@ -63,6 +64,6 @@ instance IHaskellWidget SelectMultiple where
|
||||
case nestedObjectLookup val ["state", "index"] of
|
||||
Just (Array indices) -> do
|
||||
let indicesList = map (\(Number x) -> Sci.coefficient x) $ V.toList indices
|
||||
void $ setField' widget Indices indicesList
|
||||
void $ setField' @Indices widget indicesList
|
||||
triggerSelection widget
|
||||
_ -> pure ()
|
||||
|
@ -2,6 +2,7 @@
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE DataKinds #-}
|
||||
{-# LANGUAGE TypeSynonymInstances #-}
|
||||
{-# LANGUAGE TypeApplications #-}
|
||||
|
||||
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
||||
|
||||
@ -32,7 +33,7 @@ import IHaskell.Display.Widgets.Layout.LayoutWidget
|
||||
import IHaskell.Display.Widgets.Style.DescriptionStyle
|
||||
|
||||
-- | A 'SelectionRangeSlider' represents a SelectionSlider widget from IPyhon.widgets
|
||||
type SelectionRangeSlider = IPythonWidget 'SelectionRangeSliderType
|
||||
type SelectionRangeSlider = IPythonWidget SelectionRangeSliderType
|
||||
|
||||
-- | Create a new SelectionRangeSlider widget
|
||||
mkSelectionRangeSlider :: IO SelectionRangeSlider
|
||||
@ -42,11 +43,11 @@ mkSelectionRangeSlider = do
|
||||
dstyle <- mkDescriptionStyle
|
||||
|
||||
let selectionAttrs = defaultMultipleSelectionWidget "SelectionRangeSliderView" "SelectionRangeSliderModel" layout $ StyleWidget dstyle
|
||||
selectionRangeSliderAttrs = (Orientation =:: HorizontalOrientation)
|
||||
:& (ReadOut =:: True)
|
||||
:& (ContinuousUpdate =:: True)
|
||||
selectionRangeSliderAttrs = (F @Orientation =:: HorizontalOrientation)
|
||||
:& (F @ReadOut =:: True)
|
||||
:& (F @ContinuousUpdate =:: True)
|
||||
:& RNil
|
||||
widgetState = WidgetState $ rput (Indices =:. ([0,0], rangeSliderVerification)) $ selectionAttrs <+> selectionRangeSliderAttrs
|
||||
widgetState = WidgetState $ rput (F @Indices =:. ([0,0], rangeSliderVerification)) $ selectionAttrs <+> selectionRangeSliderAttrs
|
||||
|
||||
stateIO <- newIORef widgetState
|
||||
|
||||
@ -64,6 +65,6 @@ instance IHaskellWidget SelectionRangeSlider where
|
||||
case nestedObjectLookup val ["state", "index"] of
|
||||
Just (Array indices) -> do
|
||||
let indicesList = map (\(Number x) -> Sci.coefficient x) $ V.toList indices
|
||||
void $ setField' widget Indices indicesList
|
||||
void $ setField' @Indices widget indicesList
|
||||
triggerSelection widget
|
||||
_ -> pure ()
|
||||
_ -> pure ()
|
||||
|
@ -2,6 +2,7 @@
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE DataKinds #-}
|
||||
{-# LANGUAGE TypeSynonymInstances #-}
|
||||
{-# LANGUAGE TypeApplications #-}
|
||||
|
||||
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
||||
|
||||
@ -31,7 +32,7 @@ import IHaskell.Display.Widgets.Layout.LayoutWidget
|
||||
import IHaskell.Display.Widgets.Style.DescriptionStyle
|
||||
|
||||
-- | A 'SelectionSlider' represents a SelectionSlider widget from IPyhon.widgets
|
||||
type SelectionSlider = IPythonWidget 'SelectionSliderType
|
||||
type SelectionSlider = IPythonWidget SelectionSliderType
|
||||
|
||||
-- | Create a new SelectionSLider widget
|
||||
mkSelectionSlider :: IO SelectionSlider
|
||||
@ -41,9 +42,9 @@ mkSelectionSlider = do
|
||||
dstyle <- mkDescriptionStyle
|
||||
|
||||
let selectionAttrs = defaultSelectionNonemptyWidget "SelectionSliderView" "SelectionSliderModel" layout $ StyleWidget dstyle
|
||||
selectionSliderAttrs = (Orientation =:: HorizontalOrientation)
|
||||
:& (ReadOut =:: True)
|
||||
:& (ContinuousUpdate =:: True)
|
||||
selectionSliderAttrs = (F @Orientation =:: HorizontalOrientation)
|
||||
:& (F @ReadOut =:: True)
|
||||
:& (F @ContinuousUpdate =:: True)
|
||||
:& RNil
|
||||
widgetState = WidgetState $ selectionAttrs <+> selectionSliderAttrs
|
||||
|
||||
@ -62,6 +63,6 @@ instance IHaskellWidget SelectionSlider where
|
||||
comm widget val _ =
|
||||
case nestedObjectLookup val ["state", "index"] of
|
||||
Just (Number index) -> do
|
||||
void $ setField' widget Index (Sci.coefficient index)
|
||||
void $ setField' @Index widget (Sci.coefficient index)
|
||||
triggerSelection widget
|
||||
_ -> pure ()
|
||||
_ -> pure ()
|
||||
|
@ -2,6 +2,7 @@
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE DataKinds #-}
|
||||
{-# LANGUAGE TypeSynonymInstances #-}
|
||||
{-# LANGUAGE TypeApplications #-}
|
||||
|
||||
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
||||
|
||||
@ -31,7 +32,7 @@ import IHaskell.Display.Widgets.Layout.LayoutWidget
|
||||
import IHaskell.Display.Widgets.Style.DescriptionStyle
|
||||
|
||||
-- | A 'ToggleButtons' represents a ToggleButtons widget from IPython.html.widgets.
|
||||
type ToggleButtons = IPythonWidget 'ToggleButtonsType
|
||||
type ToggleButtons = IPythonWidget ToggleButtonsType
|
||||
|
||||
-- | Create a new ToggleButtons widget
|
||||
mkToggleButtons :: IO ToggleButtons
|
||||
@ -42,9 +43,9 @@ mkToggleButtons = do
|
||||
dstyle <- mkDescriptionStyle
|
||||
|
||||
let selectionAttrs = defaultSelectionWidget "ToggleButtonsView" "ToggleButtonsModel" layout $ StyleWidget dstyle
|
||||
toggleButtonsAttrs = (Tooltips =:: [])
|
||||
:& (Icons =:: [])
|
||||
:& (ButtonStyle =:: DefaultButton)
|
||||
toggleButtonsAttrs = (F @Tooltips =:: [])
|
||||
:& (F @Icons =:: [])
|
||||
:& (F @ButtonStyleField =:: DefaultButton)
|
||||
:& RNil
|
||||
widgetState = WidgetState $ selectionAttrs <+> toggleButtonsAttrs
|
||||
|
||||
@ -63,6 +64,6 @@ instance IHaskellWidget ToggleButtons where
|
||||
comm widget val _ =
|
||||
case nestedObjectLookup val ["state", "index"] of
|
||||
Just (Number index) -> do
|
||||
void $ setField' widget OptionalIndex (Just $ Sci.coefficient index)
|
||||
void $ setField' @OptionalIndex widget (Just $ Sci.coefficient index)
|
||||
triggerSelection widget
|
||||
_ -> pure ()
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -2,6 +2,7 @@
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE DataKinds #-}
|
||||
{-# LANGUAGE TypeSynonymInstances #-}
|
||||
{-# LANGUAGE TypeApplications #-}
|
||||
|
||||
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
||||
|
||||
@ -16,7 +17,7 @@ module IHaskell.Display.Widgets.String.Combobox
|
||||
import Prelude
|
||||
|
||||
import Control.Monad (when)
|
||||
import Data.Aeson
|
||||
import Data.Aeson hiding (Options)
|
||||
import Data.IORef (newIORef)
|
||||
import Data.Vinyl (Rec(..), (<+>))
|
||||
|
||||
@ -30,7 +31,7 @@ import IHaskell.Display.Widgets.Layout.LayoutWidget
|
||||
import IHaskell.Display.Widgets.Style.DescriptionStyle
|
||||
|
||||
-- | A 'ComboboxWidget' represents a Combobox widget from IPython.html.widgets.
|
||||
type ComboboxWidget = IPythonWidget 'ComboboxType
|
||||
type ComboboxWidget = IPythonWidget ComboboxType
|
||||
|
||||
-- | Create a new Combobox widget
|
||||
mkCombobox :: IO ComboboxWidget
|
||||
@ -41,8 +42,8 @@ mkCombobox = do
|
||||
dstyle <- mkDescriptionStyle
|
||||
|
||||
let txtWidget = defaultTextWidget "ComboboxView" "ComboboxModel" layout $ StyleWidget dstyle
|
||||
boxWidget = (Options =:: [])
|
||||
:& (EnsureOption =:: False)
|
||||
boxWidget = (F @Options =:: [])
|
||||
:& (F @EnsureOption =:: False)
|
||||
:& RNil
|
||||
widgetState = WidgetState $ txtWidget <+> boxWidget
|
||||
|
||||
@ -61,7 +62,7 @@ instance IHaskellWidget ComboboxWidget where
|
||||
-- Two possibilities: 1. content -> event -> "submit" 2. sync_data -> value -> <new_value>
|
||||
comm tw val _ = do
|
||||
case nestedObjectLookup val ["state", "value"] of
|
||||
Just (String value) -> setField' tw StringValue value >> triggerChange tw
|
||||
Just (String value) -> setField' @StringValue tw value >> triggerChange tw
|
||||
_ -> pure ()
|
||||
case nestedObjectLookup val ["content", "event"] of
|
||||
Just (String event) -> when (event == "submit") $ triggerSubmit tw
|
||||
|
@ -2,6 +2,7 @@
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE DataKinds #-}
|
||||
{-# LANGUAGE TypeSynonymInstances #-}
|
||||
{-# LANGUAGE TypeApplications #-}
|
||||
|
||||
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
||||
|
||||
@ -27,7 +28,7 @@ import IHaskell.Display.Widgets.Layout.LayoutWidget
|
||||
import IHaskell.Display.Widgets.Style.DescriptionStyle
|
||||
|
||||
-- | A 'HTMLWidget' represents a HTML widget from IPython.html.widgets.
|
||||
type HTMLWidget = IPythonWidget 'HTMLType
|
||||
type HTMLWidget = IPythonWidget HTMLType
|
||||
|
||||
-- | Create a new HTML widget
|
||||
mkHTML :: IO HTMLWidget
|
||||
|
@ -2,6 +2,7 @@
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE DataKinds #-}
|
||||
{-# LANGUAGE TypeSynonymInstances #-}
|
||||
{-# LANGUAGE TypeApplications #-}
|
||||
|
||||
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
||||
|
||||
@ -27,7 +28,7 @@ import IHaskell.Display.Widgets.Layout.LayoutWidget
|
||||
import IHaskell.Display.Widgets.Style.DescriptionStyle
|
||||
|
||||
-- | A 'HTMLMathWidget' represents a HTML Math widget from IPython.html.widgets.
|
||||
type HTMLMathWidget = IPythonWidget 'HTMLMathType
|
||||
type HTMLMathWidget = IPythonWidget HTMLMathType
|
||||
|
||||
-- | Create a new HTML widget
|
||||
mkHTMLMath :: IO HTMLMathWidget
|
||||
|
@ -2,6 +2,7 @@
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE DataKinds #-}
|
||||
{-# LANGUAGE TypeSynonymInstances #-}
|
||||
{-# LANGUAGE TypeApplications #-}
|
||||
|
||||
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
||||
|
||||
@ -27,7 +28,7 @@ import IHaskell.Display.Widgets.Layout.LayoutWidget
|
||||
import IHaskell.Display.Widgets.Style.DescriptionStyle
|
||||
|
||||
-- | A 'LabelWidget' represents a Label widget from IPython.html.widgets.
|
||||
type LabelWidget = IPythonWidget 'LabelType
|
||||
type LabelWidget = IPythonWidget LabelType
|
||||
|
||||
-- | Create a new Label widget
|
||||
mkLabel :: IO LabelWidget
|
||||
|
@ -2,6 +2,7 @@
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE DataKinds #-}
|
||||
{-# LANGUAGE TypeSynonymInstances #-}
|
||||
{-# LANGUAGE TypeApplications #-}
|
||||
|
||||
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
||||
|
||||
@ -29,7 +30,7 @@ import IHaskell.Display.Widgets.Layout.LayoutWidget
|
||||
import IHaskell.Display.Widgets.Style.DescriptionStyle
|
||||
|
||||
-- | A 'PasswordWidget' represents a Password widget from IPython.html.widgets.
|
||||
type PasswordWidget = IPythonWidget 'PasswordType
|
||||
type PasswordWidget = IPythonWidget PasswordType
|
||||
|
||||
-- | Create a new Password widget
|
||||
mkPassword :: IO PasswordWidget
|
||||
@ -55,8 +56,8 @@ instance IHaskellWidget PasswordWidget where
|
||||
getCommUUID = uuid
|
||||
comm tw val _ = do
|
||||
case nestedObjectLookup val ["state", "value"] of
|
||||
Just (String value) -> setField' tw StringValue value >> triggerChange tw
|
||||
Just (String value) -> setField' @StringValue tw value >> triggerChange tw
|
||||
_ -> pure ()
|
||||
case nestedObjectLookup val ["content", "event"] of
|
||||
Just (String event) -> when (event == "submit") $ triggerSubmit tw
|
||||
_ -> pure ()
|
||||
_ -> pure ()
|
||||
|
@ -2,6 +2,7 @@
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE DataKinds #-}
|
||||
{-# LANGUAGE TypeSynonymInstances #-}
|
||||
{-# LANGUAGE TypeApplications #-}
|
||||
|
||||
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
||||
|
||||
@ -29,7 +30,7 @@ import IHaskell.Display.Widgets.Layout.LayoutWidget
|
||||
import IHaskell.Display.Widgets.Style.DescriptionStyle
|
||||
|
||||
-- | A 'TextWidget' represents a Text widget from IPython.html.widgets.
|
||||
type TextWidget = IPythonWidget 'TextType
|
||||
type TextWidget = IPythonWidget TextType
|
||||
|
||||
-- | Create a new Text widget
|
||||
mkText :: IO TextWidget
|
||||
@ -56,7 +57,7 @@ instance IHaskellWidget TextWidget where
|
||||
-- Two possibilities: 1. content -> event -> "submit" 2. state -> value -> <new_value>
|
||||
comm tw val _ = do
|
||||
case nestedObjectLookup val ["state", "value"] of
|
||||
Just (String value) -> setField' tw StringValue value >> triggerChange tw
|
||||
Just (String value) -> setField' @StringValue tw value >> triggerChange tw
|
||||
_ -> pure ()
|
||||
case nestedObjectLookup val ["content", "event"] of
|
||||
Just (String event) -> when (event == "submit") $ triggerSubmit tw
|
||||
|
@ -1,6 +1,7 @@
|
||||
{-# LANGUAGE FlexibleInstances #-}
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE DataKinds #-}
|
||||
{-# LANGUAGE TypeApplications #-}
|
||||
|
||||
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
||||
|
||||
@ -29,7 +30,7 @@ import IHaskell.Display.Widgets.Layout.LayoutWidget
|
||||
import IHaskell.Display.Widgets.Style.DescriptionStyle
|
||||
|
||||
-- | A 'TextArea' represents a Textarea widget from IPython.html.widgets.
|
||||
type TextArea = IPythonWidget 'TextAreaType
|
||||
type TextArea = IPythonWidget TextAreaType
|
||||
|
||||
-- | Create a new TextArea widget
|
||||
mkTextArea :: IO TextArea
|
||||
@ -40,10 +41,10 @@ mkTextArea = do
|
||||
dstyle <- mkDescriptionStyle
|
||||
|
||||
let strAttrs = defaultStringWidget "TextareaView" "TextareaModel" layout $ StyleWidget dstyle
|
||||
wgtAttrs = (Rows =:: Nothing)
|
||||
:& (Disabled =:: False)
|
||||
:& (ContinuousUpdate =:: True)
|
||||
:& (ChangeHandler =:: return ())
|
||||
wgtAttrs = (F @Rows =:: Nothing)
|
||||
:& (F @Disabled =:: False)
|
||||
:& (F @ContinuousUpdate =:: True)
|
||||
:& (F @ChangeHandler =:: return ())
|
||||
:& RNil
|
||||
widgetState = WidgetState $ strAttrs <+> wgtAttrs
|
||||
|
||||
@ -62,6 +63,6 @@ instance IHaskellWidget TextArea where
|
||||
comm widget val _ =
|
||||
case nestedObjectLookup val ["state", "value"] of
|
||||
Just (String value) -> do
|
||||
void $ setField' widget StringValue value
|
||||
void $ setField' @StringValue widget value
|
||||
triggerChange widget
|
||||
_ -> pure ()
|
||||
|
@ -2,6 +2,7 @@
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE DataKinds #-}
|
||||
{-# LANGUAGE TypeSynonymInstances #-}
|
||||
{-# LANGUAGE TypeApplications #-}
|
||||
|
||||
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
||||
|
||||
@ -24,10 +25,10 @@ import IHaskell.Eval.Widgets
|
||||
import IHaskell.IPython.Message.UUID as U
|
||||
|
||||
import IHaskell.Display.Widgets.Types
|
||||
import IHaskell.Display.Widgets.Common
|
||||
import IHaskell.Display.Widgets.Common as C
|
||||
|
||||
-- | A 'ButtonStyle' represents a Button Style from IPython.html.widgets.
|
||||
type ButtonStyle = IPythonWidget 'ButtonStyleType
|
||||
type ButtonStyle = IPythonWidget ButtonStyleType
|
||||
|
||||
-- | Create a new button style
|
||||
mkButtonStyle :: IO ButtonStyle
|
||||
@ -35,14 +36,14 @@ mkButtonStyle = do
|
||||
wid <- U.random
|
||||
|
||||
let stl = defaultStyleWidget "ButtonStyleModel"
|
||||
but = (ButtonColor =:: Nothing)
|
||||
:& (FontFamily =:: Nothing)
|
||||
:& (FontSize =:: Nothing)
|
||||
:& (FontStyle =:: Nothing)
|
||||
:& (FontVariant =:: Nothing)
|
||||
:& (FontWeight =:: DefaultWeight)
|
||||
:& (TextColor =:: Nothing)
|
||||
:& (TextDecoration =:: Nothing)
|
||||
but = (F @ButtonColor =:: Nothing)
|
||||
:& (F @FontFamily =:: Nothing)
|
||||
:& (F @FontSize =:: Nothing)
|
||||
:& (F @FontStyle =:: Nothing)
|
||||
:& (F @FontVariant =:: Nothing)
|
||||
:& (F @FontWeight =:: DefaultWeight)
|
||||
:& (F @TextColor =:: Nothing)
|
||||
:& (F @TextDecoration =:: Nothing)
|
||||
:& RNil
|
||||
btnStlState = WidgetState (stl <+> but)
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE DataKinds #-}
|
||||
{-# LANGUAGE TypeSynonymInstances #-}
|
||||
{-# LANGUAGE TypeApplications #-}
|
||||
|
||||
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
||||
|
||||
@ -25,7 +26,7 @@ import IHaskell.IPython.Message.UUID as U
|
||||
import IHaskell.Display.Widgets.Types
|
||||
|
||||
-- | A 'DescriptionStyle' represents a Button Style from IPython.html.widgets.
|
||||
type DescriptionStyle = IPythonWidget 'DescriptionStyleType
|
||||
type DescriptionStyle = IPythonWidget DescriptionStyleType
|
||||
|
||||
-- | Create a new button style
|
||||
mkDescriptionStyle :: IO DescriptionStyle
|
||||
|
@ -2,6 +2,7 @@
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE DataKinds #-}
|
||||
{-# LANGUAGE TypeSynonymInstances #-}
|
||||
{-# LANGUAGE TypeApplications #-}
|
||||
|
||||
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
||||
|
||||
@ -27,7 +28,7 @@ import IHaskell.Display.Widgets.Types
|
||||
import IHaskell.Display.Widgets.Common
|
||||
|
||||
-- | A 'ProgressStyle' represents a Button Style from IPython.html.widgets.
|
||||
type ProgressStyle = IPythonWidget 'ProgressStyleType
|
||||
type ProgressStyle = IPythonWidget ProgressStyleType
|
||||
|
||||
-- | Create a new button style
|
||||
mkProgressStyle :: IO ProgressStyle
|
||||
@ -35,7 +36,7 @@ mkProgressStyle = do
|
||||
wid <- U.random
|
||||
|
||||
let stl = defaultDescriptionStyleWidget "ProgressStyleModel"
|
||||
but = (BarColor =:: Nothing)
|
||||
but = (F @BarColor =:: Nothing)
|
||||
:& RNil
|
||||
btnStlState = WidgetState (stl <+> but)
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE DataKinds #-}
|
||||
{-# LANGUAGE TypeSynonymInstances #-}
|
||||
{-# LANGUAGE TypeApplications #-}
|
||||
|
||||
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
||||
|
||||
@ -27,7 +28,7 @@ import IHaskell.Display.Widgets.Types
|
||||
import IHaskell.Display.Widgets.Common
|
||||
|
||||
-- | A 'SliderStyle' represents a Button Style from IPython.html.widgets.
|
||||
type SliderStyle = IPythonWidget 'SliderStyleType
|
||||
type SliderStyle = IPythonWidget SliderStyleType
|
||||
|
||||
-- | Create a new button style
|
||||
mkSliderStyle :: IO SliderStyle
|
||||
@ -35,7 +36,7 @@ mkSliderStyle = do
|
||||
wid <- U.random
|
||||
|
||||
let stl = defaultDescriptionStyleWidget "SliderStyleModel"
|
||||
but = (HandleColor =:: Nothing)
|
||||
but = (F @HandleColor =:: Nothing)
|
||||
:& RNil
|
||||
btnStlState = WidgetState (stl <+> but)
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE DataKinds #-}
|
||||
{-# LANGUAGE TypeSynonymInstances #-}
|
||||
{-# LANGUAGE TypeApplications #-}
|
||||
|
||||
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
||||
|
||||
@ -27,7 +28,7 @@ import IHaskell.Display.Widgets.Types
|
||||
import IHaskell.Display.Widgets.Common
|
||||
|
||||
-- | A 'ToggleButtonsStyle' represents a Button Style from IPython.html.widgets.
|
||||
type ToggleButtonsStyle = IPythonWidget 'ToggleButtonsStyleType
|
||||
type ToggleButtonsStyle = IPythonWidget ToggleButtonsStyleType
|
||||
|
||||
-- | Create a new button style
|
||||
mkToggleButtonsStyle :: IO ToggleButtonsStyle
|
||||
@ -35,8 +36,8 @@ mkToggleButtonsStyle = do
|
||||
wid <- U.random
|
||||
|
||||
let stl = defaultDescriptionStyleWidget "ToggleButtonsStyleModel"
|
||||
but = (ButtonWidth =:: "")
|
||||
:& (FontWeight =:: DefaultWeight)
|
||||
but = (F @ButtonWidth =:: "")
|
||||
:& (F @FontWeight =:: DefaultWeight)
|
||||
:& RNil
|
||||
btnStlState = WidgetState (stl <+> but)
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user