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
9d3167b8
Commit
9d3167b8
authored
Nov 11, 2013
by
Andrew Gibiansky
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reorganization to move all evaluators into Eval/
parent
ab5b30e2
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
35 additions
and
27 deletions
+35
-27
Haskell-Notebook.ipynb
Haskell-Notebook.ipynb
+14
-11
IHaskell.cabal
IHaskell.cabal
+2
-1
Completion.hs
IHaskell/Eval/Completion.hs
+1
-1
Evaluate.hs
IHaskell/Eval/Evaluate.hs
+14
-6
Main.hs
Main.hs
+4
-8
No files found.
Haskell-Notebook.ipynb
View file @
9d3167b8
...
@@ -163,20 +163,23 @@
...
@@ -163,20 +163,23 @@
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [
{
{
"html": [
"metadata": {},
"<span style='color: red; font-style: italic;'>IHaskell/Eval/Evaluate.hs:207:58-84: Non-exhaustive patterns in lambda<br/></span>"
"output_type": "pyout",
],
"prompt_number": 10,
"text": []
},
{
"metadata": {},
"metadata": {},
"output_type": "display_data"
"output_type": "display_data"
}
}
],
],
"prompt_number":
9
"prompt_number":
10
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"collapsed": false,
"collapsed": false,
"input": [
"input": [
"f
3
"
"f
2
"
],
],
"language": "python",
"language": "python",
"metadata": {},
"metadata": {},
...
@@ -184,9 +187,9 @@
...
@@ -184,9 +187,9 @@
{
{
"metadata": {},
"metadata": {},
"output_type": "pyout",
"output_type": "pyout",
"prompt_number":
7
,
"prompt_number":
11
,
"text": [
"text": [
"
2
\n"
"
3
\n"
]
]
},
},
{
{
...
@@ -194,13 +197,13 @@
...
@@ -194,13 +197,13 @@
"output_type": "display_data"
"output_type": "display_data"
}
}
],
],
"prompt_number":
7
"prompt_number":
11
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"collapsed": false,
"collapsed": false,
"input": [
"input": [
"
f 2
"
"
it11
"
],
],
"language": "python",
"language": "python",
"metadata": {},
"metadata": {},
...
@@ -208,7 +211,7 @@
...
@@ -208,7 +211,7 @@
{
{
"metadata": {},
"metadata": {},
"output_type": "pyout",
"output_type": "pyout",
"prompt_number":
8
,
"prompt_number":
12
,
"text": [
"text": [
"3\n"
"3\n"
]
]
...
@@ -218,7 +221,7 @@
...
@@ -218,7 +221,7 @@
"output_type": "display_data"
"output_type": "display_data"
}
}
],
],
"prompt_number":
8
"prompt_number":
12
},
},
{
{
"cell_type": "code",
"cell_type": "code",
...
...
IHaskell.cabal
View file @
9d3167b8
...
@@ -51,7 +51,8 @@ executable IHaskell
...
@@ -51,7 +51,8 @@ executable IHaskell
-- Modules included in this executable, other than Main.
-- Modules included in this executable, other than Main.
other-modules:
other-modules:
IHaskell.Completion
IHaskell.Eval.Completion
IHaskell.Eval.Info
IHaskell.Eval.Evaluate
IHaskell.Eval.Evaluate
IHaskell.IPython
IHaskell.IPython
IHaskell.Message.Parser
IHaskell.Message.Parser
...
...
IHaskell/Completion.hs
→
IHaskell/
Eval/
Completion.hs
View file @
9d3167b8
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
names should not be confused by the third option.
names should not be confused by the third option.
-}
-}
module
IHaskell.Completion
(
makeCompletions
)
where
module
IHaskell.
Eval.
Completion
(
makeCompletions
)
where
import
Prelude
import
Prelude
import
Data.List
(
find
,
isPrefixOf
,
nub
)
import
Data.List
(
find
,
isPrefixOf
,
nub
)
...
...
IHaskell/Eval/Evaluate.hs
View file @
9d3167b8
...
@@ -6,7 +6,8 @@
...
@@ -6,7 +6,8 @@
This module exports all functions used for evaluation of IHaskell input.
This module exports all functions used for evaluation of IHaskell input.
-}
-}
module
IHaskell.Eval.Evaluate
(
module
IHaskell.Eval.Evaluate
(
interpret
,
evaluate
,
Interpreter
,
liftIO
interpret
,
evaluate
,
Interpreter
,
liftIO
,
typeCleaner
)
where
)
where
import
ClassyPrelude
hiding
(
liftIO
,
hGetContents
)
import
ClassyPrelude
hiding
(
liftIO
,
hGetContents
)
...
@@ -38,7 +39,13 @@ debug :: Bool
...
@@ -38,7 +39,13 @@ debug :: Bool
debug
=
True
debug
=
True
ignoreTypePrefixes
::
[
String
]
ignoreTypePrefixes
::
[
String
]
ignoreTypePrefixes
=
[
"GHC.Types"
,
"GHC.Base"
]
ignoreTypePrefixes
=
[
"GHC.Types"
,
"GHC.Base"
,
"GHC.Show"
,
"System.IO"
]
typeCleaner
::
String
->
String
typeCleaner
=
useStringType
.
foldl'
(
.
)
id
(
map
(`
replace
`
""
)
fullPrefixes
)
where
fullPrefixes
=
map
(
++
"."
)
ignoreTypePrefixes
useStringType
=
replace
"[Char]"
"String"
makeWrapperStmts
::
(
String
,
[
String
],
[
String
])
makeWrapperStmts
::
(
String
,
[
String
],
[
String
])
makeWrapperStmts
=
(
fileName
,
initStmts
,
postStmts
)
makeWrapperStmts
=
(
fileName
,
initStmts
,
postStmts
)
...
@@ -312,8 +319,9 @@ parseStmts code =
...
@@ -312,8 +319,9 @@ parseStmts code =
returnStmt
=
"return ()"
returnStmt
=
"return ()"
makeError
::
String
->
String
makeError
::
String
->
String
makeError
=
printf
"<span style='color: red; font-style: italic;'>%s</span>"
.
replace
"
\n
"
"<br/>"
.
dropper
makeError
=
printf
"<span style='color: red; font-style: italic;'>%s</span>"
.
where
dropper
=
foldl'
(
.
)
useStringType
(
map
(`
replace
`
""
)
dropList
)
replace
"
\n
"
"<br/>"
.
dropList
=
useDashV
:
map
(
++
"."
)
ignoreTypePrefixes
replace
useDashV
""
.
typeCleaner
where
useDashV
=
"
\n
Use -v to see a list of the files searched for."
useDashV
=
"
\n
Use -v to see a list of the files searched for."
useStringType
=
replace
"[Char]"
"String"
Main.hs
View file @
9d3167b8
...
@@ -16,9 +16,10 @@ import IHaskell.Types
...
@@ -16,9 +16,10 @@ import IHaskell.Types
import
IHaskell.ZeroMQ
import
IHaskell.ZeroMQ
import
qualified
IHaskell.Message.UUID
as
UUID
import
qualified
IHaskell.Message.UUID
as
UUID
import
IHaskell.Eval.Evaluate
import
IHaskell.Eval.Evaluate
import
IHaskell.Eval.Completion
(
makeCompletions
)
import
IHaskell.Eval.Info
import
qualified
Data.ByteString.Char8
as
Chars
import
qualified
Data.ByteString.Char8
as
Chars
import
IHaskell.IPython
import
IHaskell.IPython
import
IHaskell.Completion
(
makeCompletions
)
import
GHC
import
GHC
import
Outputable
(
showSDoc
,
ppr
)
import
Outputable
(
showSDoc
,
ppr
)
...
@@ -179,16 +180,11 @@ replyTo _ creq@CompleteRequest{} replyHeader state = do
...
@@ -179,16 +180,11 @@ replyTo _ creq@CompleteRequest{} replyHeader state = do
-- | Reply to the object_info_request message. Given an object name, return
-- | Reply to the object_info_request message. Given an object name, return
-- | the associated type calculated by GHC.
-- | the associated type calculated by GHC.
replyTo
_
ObjectInfoRequest
{
objectName
=
oname
}
replyHeader
state
=
do
replyTo
_
ObjectInfoRequest
{
objectName
=
oname
}
replyHeader
state
=
do
dflags
<-
getSessionDynFlags
docs
<-
info
$
Chars
.
unpack
oname
maybeDocs
<-
flip
gcatch
(
\
(
_
::
SomeException
)
->
return
Nothing
)
$
do
result
<-
exprType
.
Chars
.
unpack
$
oname
let
docs
=
showSDoc
dflags
.
ppr
$
result
return
(
Just
docs
)
let
docs
=
fromMaybe
""
maybeDocs
let
reply
=
ObjectInfoReply
{
let
reply
=
ObjectInfoReply
{
header
=
replyHeader
,
header
=
replyHeader
,
objectName
=
oname
,
objectName
=
oname
,
objectFound
=
isJust
maybeDocs
,
objectFound
=
docs
==
""
,
objectTypeString
=
Chars
.
pack
docs
,
objectTypeString
=
Chars
.
pack
docs
,
objectDocString
=
Chars
.
pack
docs
objectDocString
=
Chars
.
pack
docs
}
}
...
...
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