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
318234ca
Commit
318234ca
authored
Jan 09, 2014
by
Andrew Gibiansky
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Closes issue #21, also added some images
parent
4f92c0b3
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
137 additions
and
75 deletions
+137
-75
IHaskell.ipynb
IHaskell.ipynb
+119
-48
doc-demo.png
images/doc-demo.png
+0
-0
Evaluate.hs
src/IHaskell/Eval/Evaluate.hs
+18
-27
No files found.
IHaskell.ipynb
View file @
318234ca
This diff is collapsed.
Click to expand it.
images/doc-demo.png
0 → 100644
View file @
318234ca
28.7 KB
src/IHaskell/Eval/Evaluate.hs
View file @
318234ca
...
...
@@ -652,38 +652,29 @@ evalCommand output (Statement stmt) state = wrapExecution state $ do
evalCommand
output
(
Expression
expr
)
state
=
do
write
$
"Expression:
\n
"
++
expr
-- Check if we can display this.
let
displayExpr
=
printf
"(IHaskell.Display.display (%s))"
expr
::
String
canRunDisplay
<-
attempt
$
exprType
displayExpr
-- Evaluate this expression as though it's just a statement.
-- The output is bound to 'it', so we can then use it.
evalOut
<-
evalCommand
output
(
Statement
expr
)
state
-- Try to use `display` to convert our type into the output
-- DisplayData. If typechecking fails and there is no appropriate
-- typeclass instance, this will throw an exception and thus `attempt` will
-- return False, and we just resort to plaintext.
let
out
=
evalResult
evalOut
showErr
=
isShowError
out
write
$
printf
"%s: Attempting %s"
(
if
canRunDisplay
then
"Success"
else
"Failure"
)
displayExpr
write
$
"Show Error: "
++
show
showErr
write
$
show
out
-- If evaluation failed, return the failure. If it was successful, we
-- may be able to use the IHaskellDisplay typeclass.
if
not
canRunDisplay
then
return
$
if
not
showErr
||
useShowErrors
state
then
evalOut
else
postprocessShowError
evalOut
else
case
evalStatus
evalOut
of
Success
->
useDisplay
displayExpr
-- If something other than the show failed, don't use display, just
-- show the error message.
Failure
->
if
showErr
then
useDisplay
displayExpr
else
return
evalOut
let
displayExpr
=
printf
"(IHaskell.Display.display (%s))"
expr
::
String
canRunDisplay
<-
attempt
$
exprType
displayExpr
if
canRunDisplay
then
useDisplay
displayExpr
else
do
-- Evaluate this expression as though it's just a statement.
-- The output is bound to 'it', so we can then use it.
evalOut
<-
evalCommand
output
(
Statement
expr
)
state
let
out
=
evalResult
evalOut
showErr
=
isShowError
out
-- If evaluation failed, return the failure. If it was successful, we
-- may be able to use the IHaskellDisplay typeclass.
return
$
if
not
showErr
||
useShowErrors
state
then
evalOut
else
postprocessShowError
evalOut
where
-- Try to evaluate an action. Return True if it succeeds and False if
...
...
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