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
9b95c5e3
Commit
9b95c5e3
authored
May 18, 2014
by
Andrew Gibiansky
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added support for -XNoImplicitPrelude properly
parent
0fc3a1a9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
5 deletions
+19
-5
Test.ipynb
notebooks/Test.ipynb
+4
-4
Evaluate.hs
src/IHaskell/Eval/Evaluate.hs
+15
-1
No files found.
notebooks/Test.ipynb
View file @
9b95c5e3
...
...
@@ -36,8 +36,8 @@
"cell_type": "code",
"collapsed": false,
"input": [
":
load a/Test.hs
\n",
"
test
"
":
ext Impli
\n",
"
4 + 4
"
],
"language": "python",
"metadata": {
...
...
@@ -48,11 +48,11 @@
"metadata": {},
"output_type": "display_data",
"text": [
"
3
"
"
8
"
]
}
],
"prompt_number":
14
"prompt_number":
2
},
{
"cell_type": "code",
...
...
src/IHaskell/Eval/Evaluate.hs
View file @
9b95c5e3
...
...
@@ -105,6 +105,7 @@ instance MonadIO.MonadIO Interpreter where
globalImports
::
[
String
]
globalImports
=
[
"import IHaskell.Display()"
,
"import qualified Prelude as IHaskellPrelude"
,
"import qualified IHaskell.Display"
,
"import qualified IHaskell.IPython.Stdin"
,
"import qualified System.Posix.IO as IHaskellIO"
...
...
@@ -409,6 +410,19 @@ evalCommand output (Directive SetDynFlag flags) state =
let
display
=
case
errs
of
[]
->
mempty
_
->
displayError
$
intercalate
"
\n
"
errs
-- For -XNoImplicitPrelude, remove the Prelude import.
-- For -XImplicitPrelude, add it back in.
case
flag
of
"-XNoImplicitPrelude"
->
evalImport
"import qualified Prelude as Prelude"
"-XImplicitPrelude"
->
do
importDecl
<-
parseImportDecl
"import Prelude"
let
implicitPrelude
=
importDecl
{
ideclImplicit
=
True
}
imports
<-
getContext
setContext
$
IIDecl
implicitPrelude
:
imports
_
->
return
()
return
EvalOut
{
evalStatus
=
Success
,
evalResult
=
display
,
...
...
@@ -1005,7 +1019,7 @@ capturedStatement output stmt = do
-- Variable used to store true `it` value.
itVariable
=
var
"it_var_"
voidpf
str
=
printf
$
str
++
"
>>
return ()"
voidpf
str
=
printf
$
str
++
"
IHaskellPrelude.>> IHaskellPrelude.
return ()"
-- Statements run before the thing we're evaluating.
initStmts
=
...
...
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