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
258a07d3
Commit
258a07d3
authored
Jan 26, 2014
by
Andrew Gibiansky
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated
parent
b7070c77
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
36 deletions
+44
-36
Test.ipynb
notebooks/Test.ipynb
+2
-1
Parser.hs
src/IHaskell/Eval/Parser.hs
+1
-0
Main.hs
src/Main.hs
+41
-35
No files found.
notebooks/Test.ipynb
View file @
258a07d3
...
...
@@ -36,7 +36,8 @@
"cell_type": "code",
"collapsed": false,
"input": [
"import Control.Monad.Identity"
"import Control.Monad.Identity\n",
"lkajsdflkj "
],
"language": "python",
"metadata": {},
...
...
src/IHaskell/Eval/Parser.hs
View file @
258a07d3
...
...
@@ -129,6 +129,7 @@ activateParsingExtensions (Directive SetDynFlag flags) =
case
stripPrefix
"-X"
flags
of
Just
ext
->
void
$
setExtension
ext
Nothing
->
return
()
activateParsingExtensions
_
=
return
()
-- | Parse a single chunk of code, as indicated by the layout of the code.
parseCodeChunk
::
GhcMonad
m
=>
String
->
LineNumber
->
m
CodeBlock
...
...
src/Main.hs
View file @
258a07d3
...
...
@@ -2,29 +2,35 @@
-- | Description : Argument parsing and basic messaging loop, using Haskell
-- Chans to communicate with the ZeroMQ sockets.
module
Main
where
import
ClassyPrelude
hiding
(
liftIO
)
import
Prelude
(
last
,
read
)
import
Control.Concurrent.Chan
import
Control.Concurrent
(
threadDelay
)
import
Data.Aeson
import
Text.Printf
import
System.Exit
(
exitSuccess
)
import
System.Directory
import
qualified
Data.Map
as
Map
import
IHaskell.Types
import
IPython.ZeroMQ
import
qualified
IPython.Message.UUID
as
UUID
import
IHaskell.Eval.Evaluate
import
IHaskell.Eval.Completion
(
complete
)
import
IHaskell.Eval.Info
import
qualified
Data.ByteString.Char8
as
Chars
import
IHaskell.IPython
import
qualified
IPython.Stdin
as
Stdin
import
IHaskell.Flags
import
GHC
hiding
(
extensions
,
language
)
-- Prelude imports.
import
ClassyPrelude
hiding
(
liftIO
)
import
Prelude
(
last
,
read
)
-- Standard library imports.
import
Control.Concurrent
(
threadDelay
)
import
Control.Concurrent.Chan
import
Data.Aeson
import
Data.String.Utils
(
strip
)
import
System.Directory
import
System.Exit
(
exitSuccess
)
import
Text.Printf
import
qualified
Data.Map
as
Map
-- IHaskell imports.
import
IHaskell.Eval.Completion
(
complete
)
import
IHaskell.Eval.Evaluate
import
IHaskell.Eval.Info
import
IHaskell.Flags
import
IHaskell.IPython
import
IHaskell.Types
import
IPython.ZeroMQ
import
qualified
Data.ByteString.Char8
as
Chars
import
qualified
IPython.Message.UUID
as
UUID
import
qualified
IPython.Stdin
as
Stdin
-- GHC API imports.
import
GHC
hiding
(
extensions
,
language
)
import
Outputable
(
showSDoc
,
ppr
)
-- | Compute the GHC API version number using the dist/build/autogen/cabal_macros.h
...
...
@@ -304,23 +310,23 @@ replyTo interface req@ExecuteRequest{ getCode = code } replyHeader state = do
replyTo
_
req
@
CompleteRequest
{}
replyHeader
state
=
do
(
matchedText
,
completions
)
<-
complete
(
Chars
.
unpack
$
getCodeLine
req
)
(
getCursorPos
req
)
(
matchedText
,
completions
)
<-
complete
(
Chars
.
unpack
$
getCodeLine
req
)
(
getCursorPos
req
)
let
reply
=
CompleteReply
replyHeader
(
map
Chars
.
pack
completions
)
(
Chars
.
pack
matchedText
)
(
getCodeLine
req
)
True
return
(
state
,
reply
)
let
reply
=
CompleteReply
replyHeader
(
map
Chars
.
pack
completions
)
(
Chars
.
pack
matchedText
)
(
getCodeLine
req
)
True
return
(
state
,
reply
)
-- | Reply to the object_info_request message. Given an object name, return
-- | the associated type calculated by GHC.
replyTo
_
ObjectInfoRequest
{
objectName
=
oname
}
replyHeader
state
=
do
docs
<-
info
$
Chars
.
unpack
oname
let
reply
=
ObjectInfoReply
{
header
=
replyHeader
,
objectName
=
oname
,
objectFound
=
docs
=
=
""
,
objectTypeString
=
Chars
.
pack
docs
,
objectDocString
=
Chars
.
pack
docs
}
return
(
state
,
reply
)
docs
<-
info
$
Chars
.
unpack
oname
let
reply
=
ObjectInfoReply
{
header
=
replyHeader
,
objectName
=
oname
,
objectFound
=
strip
docs
/
=
""
,
objectTypeString
=
Chars
.
pack
docs
,
objectDocString
=
Chars
.
pack
docs
}
return
(
state
,
reply
)
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