Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
gargantext-ihaskell
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gargantext
gargantext-ihaskell
Commits
c3da8848
Commit
c3da8848
authored
May 17, 2014
by
Andrew Gibiansky
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
now actually works
parent
670ccde9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
16 deletions
+32
-16
widget.js
ihaskell-display/ihaskell-parsec/widget.js
+9
-4
Test.ipynb
notebooks/Test.ipynb
+20
-9
Lint.hs
src/IHaskell/Eval/Lint.hs
+3
-3
No files found.
ihaskell-display/ihaskell-parsec/widget.js
View file @
c3da8848
...
@@ -7,6 +7,8 @@ if (initialized && window.parsecWidgetRegistered === undefined) {
...
@@ -7,6 +7,8 @@ if (initialized && window.parsecWidgetRegistered === undefined) {
// Do not load this script again.
// Do not load this script again.
window
.
parsecWidgetRegistered
=
true
;
window
.
parsecWidgetRegistered
=
true
;
var
parsecWidgetCounter
=
0
;
// Register the comm target.
// Register the comm target.
var
ParsecWidget
=
function
(
comm
)
{
var
ParsecWidget
=
function
(
comm
)
{
this
.
comm
=
comm
;
this
.
comm
=
comm
;
...
@@ -47,6 +49,10 @@ var ParsecWidget = function (comm) {
...
@@ -47,6 +49,10 @@ var ParsecWidget = function (comm) {
var
out
=
this
.
cell
.
output_area
.
element
;
var
out
=
this
.
cell
.
output_area
.
element
;
this
.
textarea
=
out
.
find
(
"#parsec-editor"
)[
0
];
this
.
textarea
=
out
.
find
(
"#parsec-editor"
)[
0
];
this
.
output
=
out
.
find
(
"#parsec-output"
)[
0
];
this
.
output
=
out
.
find
(
"#parsec-output"
)[
0
];
// Give the elements a different name.
this
.
textarea
.
id
+=
parsecWidgetCounter
;
this
.
output
.
id
+=
parsecWidgetCounter
;
parsecWidgetCounter
++
;
var
editor
=
CodeMirror
.
fromTextArea
(
this
.
textarea
,
options
);
var
editor
=
CodeMirror
.
fromTextArea
(
this
.
textarea
,
options
);
var
editor
=
editor
;
var
editor
=
editor
;
...
@@ -61,14 +67,13 @@ var ParsecWidget = function (comm) {
...
@@ -61,14 +67,13 @@ var ParsecWidget = function (comm) {
ParsecWidget
.
prototype
.
handler
=
function
(
msg
)
{
ParsecWidget
.
prototype
.
handler
=
function
(
msg
)
{
var
data
=
msg
.
content
.
data
;
var
data
=
msg
.
content
.
data
;
this
.
hasError
=
data
[
"status"
]
==
"error"
;
this
.
hasError
=
data
[
"status"
]
==
"error"
;
console
.
log
(
'handler'
,
msg
);
if
(
this
.
hasError
)
{
if
(
this
.
hasError
)
{
out
=
data
[
"msg"
];
this
.
output
.
innerHTML
=
data
[
"msg"
];
this
.
error
=
data
;
this
.
error
=
data
;
}
else
{
}
else
{
out
=
data
[
"result"
];
this
.
output
.
innerHTML
=
data
[
"result"
];
}
}
// Update viewed output.
this
.
output
.
innerHTML
=
out
;
};
};
// Register this widget.
// Register this widget.
...
...
notebooks/Test.ipynb
View file @
c3da8848
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
"celltoolbar": "Hiding",
"celltoolbar": "Hiding",
"language": "haskell",
"language": "haskell",
"name": "",
"name": "",
"signature": "sha256:
444705f910fcdf32804f8966333f9306a779ea3b3a6123eff79873d78e4c6f56
"
"signature": "sha256:
804b433cf50ca6157f3f59dbddeffdb20dda07eee3e4701830f71f5eee0fbfd3
"
},
},
"nbformat": 3,
"nbformat": 3,
"nbformat_minor": 0,
"nbformat_minor": 0,
...
@@ -36,16 +36,22 @@
...
@@ -36,16 +36,22 @@
"cell_type": "code",
"cell_type": "code",
"collapsed": false,
"collapsed": false,
"input": [
"input": [
"
Slider
"
"
1+1
"
],
],
"language": "python",
"language": "python",
"metadata": {},
"metadata": {
"hidden": false
},
"outputs": [
"outputs": [
{
{
"metadata": {},
"metadata": {},
"output_type": "display_data"
"output_type": "display_data",
"text": [
"2"
]
}
}
]
],
"prompt_number": 1
},
},
{
{
"cell_type": "code",
"cell_type": "code",
...
@@ -104,6 +110,8 @@
...
@@ -104,6 +110,8 @@
"// Do not load this script again.\n",
"// Do not load this script again.\n",
"window.parsecWidgetRegistered = true;\n",
"window.parsecWidgetRegistered = true;\n",
"\n",
"\n",
"var parsecWidgetCounter = 0;\n",
"\n",
"// Register the comm target.\n",
"// Register the comm target.\n",
"var ParsecWidget = function (comm) {\n",
"var ParsecWidget = function (comm) {\n",
" this.comm = comm;\n",
" this.comm = comm;\n",
...
@@ -144,6 +152,10 @@
...
@@ -144,6 +152,10 @@
" var out = this.cell.output_area.element;\n",
" var out = this.cell.output_area.element;\n",
" this.textarea = out.find(\"#parsec-editor\")[0];\n",
" this.textarea = out.find(\"#parsec-editor\")[0];\n",
" this.output = out.find(\"#parsec-output\")[0];\n",
" this.output = out.find(\"#parsec-output\")[0];\n",
" // Give the elements a different name.\n",
" this.textarea.id += parsecWidgetCounter;\n",
" this.output.id += parsecWidgetCounter;\n",
" parsecWidgetCounter++;\n",
"\n",
"\n",
" var editor = CodeMirror.fromTextArea(this.textarea, options);\n",
" var editor = CodeMirror.fromTextArea(this.textarea, options);\n",
" var editor = editor;\n",
" var editor = editor;\n",
...
@@ -158,14 +170,13 @@
...
@@ -158,14 +170,13 @@
"ParsecWidget.prototype.handler = function(msg) {\n",
"ParsecWidget.prototype.handler = function(msg) {\n",
" var data = msg.content.data;\n",
" var data = msg.content.data;\n",
" this.hasError = data[\"status\"] == \"error\";\n",
" this.hasError = data[\"status\"] == \"error\";\n",
" console.log('handler', msg);\n",
" if (this.hasError) {\n",
" if (this.hasError) {\n",
"
out
= data[\"msg\"];\n",
"
this.output.innerHTML
= data[\"msg\"];\n",
" this.error = data;\n",
" this.error = data;\n",
" } else {\n",
" } else {\n",
"
out
= data[\"result\"];\n",
"
this.output.innerHTML
= data[\"result\"];\n",
" }\n",
" }\n",
" // Update viewed output.\n",
" this.output.innerHTML = out;\n",
"};\n",
"};\n",
"\n",
"\n",
"// Register this widget.\n",
"// Register this widget.\n",
...
...
src/IHaskell/Eval/Lint.hs
View file @
c3da8848
...
@@ -56,14 +56,14 @@ lintIdent = "lintIdentAEjlkQeh"
...
@@ -56,14 +56,14 @@ lintIdent = "lintIdentAEjlkQeh"
lint
::
[
Located
CodeBlock
]
->
IO
Display
lint
::
[
Located
CodeBlock
]
->
IO
Display
lint
blocks
=
do
lint
blocks
=
do
-- Initialize hlint settings
-- Initialize hlint settings
initialized
<-
isEmptyMVar
hlintSettings
initialized
<-
not
<$>
isEmptyMVar
hlintSettings
when
(
not
initialized
)
$
autoSettings
>>=
putMVar
hlintSettings
when
(
not
initialized
)
$
do
autoSettings
>>=
putMVar
hlintSettings
-- Get hlint settings
-- Get hlint settings
(
flags
,
classify
,
hint
)
<-
readMVar
hlintSettings
(
flags
,
classify
,
hint
)
<-
readMVar
hlintSettings
let
mode
=
hseFlags
flags
let
mode
=
hseFlags
flags
-- create 'suggestions'
-- create 'suggestions'
let
modules
=
mapMaybe
(
createModule
mode
)
blocks
let
modules
=
mapMaybe
(
createModule
mode
)
blocks
ideas
=
applyHints
classify
hint
modules
ideas
=
applyHints
classify
hint
modules
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment