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
fb22bcf4
Commit
fb22bcf4
authored
Mar 09, 2014
by
Andrew Gibiansky
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed text/bytestring handling in Main, as per @aavogt's PR
parent
0f6651e9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
10 deletions
+12
-10
Main.hs
src/Main.hs
+12
-10
No files found.
src/Main.hs
View file @
fb22bcf4
...
...
@@ -11,7 +11,7 @@ import Prelude (last, read)
import
Control.Concurrent
(
threadDelay
)
import
Control.Concurrent.Chan
import
Data.Aeson
import
Data.
String.Utils
(
strip
)
import
Data.
Text
(
strip
)
import
System.Directory
import
System.Exit
(
exitSuccess
)
import
Text.Printf
...
...
@@ -19,6 +19,7 @@ import System.Posix.Signals
import
qualified
Data.Map
as
Map
-- IHaskell imports.
import
IHaskell.Convert
(
convert
)
import
IHaskell.Eval.Completion
(
complete
)
import
IHaskell.Eval.Evaluate
import
IHaskell.Display
...
...
@@ -34,7 +35,6 @@ 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
ghcVersionInts
::
[
Int
]
...
...
@@ -62,6 +62,8 @@ ihaskell :: Args -> IO ()
ihaskell
(
Args
(
ShowHelp
help
)
_
)
=
putStrLn
$
pack
help
ihaskell
(
Args
ConvertLhs
args
)
=
convert
args
ihaskell
(
Args
Console
flags
)
=
showingHelp
Console
flags
$
do
ipython
<-
chooseIPython
flags
setupIPython
ipython
...
...
@@ -274,9 +276,9 @@ replyTo interface req@ExecuteRequest{ getCode = code } replyHeader state = do
header
<-
dupHeader
replyHeader
DisplayDataMessage
send
$
PublishDisplayData
header
"haskell"
$
map
convertSvgToHtml
outs
convertSvgToHtml
(
DisplayData
MimeSvg
svg
)
=
html
$
makeSvgImg
$
base64
svg
convertSvgToHtml
(
DisplayData
MimeSvg
svg
)
=
html
$
makeSvgImg
$
base64
$
encodeUtf8
svg
convertSvgToHtml
x
=
x
makeSvgImg
base64data
=
Chars
.
unpack
$
"<img src=
\"
data:image/svg+xml;base64,"
++
base64data
++
"
\"
/>"
makeSvgImg
base64data
=
unpack
$
"<img src=
\"
data:image/svg+xml;base64,"
++
base64data
++
"
\"
/>"
publish
::
EvaluationResult
->
IO
()
publish
result
=
do
...
...
@@ -310,9 +312,9 @@ replyTo interface req@ExecuteRequest{ getCode = code } replyHeader state = do
let
execCount
=
getExecutionCounter
state
-- Let all frontends know the execution count and code that's about to run
inputHeader
<-
liftIO
$
dupHeader
replyHeader
InputMessage
send
$
PublishInput
inputHeader
(
Chars
.
unpack
code
)
execCount
send
$
PublishInput
inputHeader
(
unpack
code
)
execCount
-- Run code and publish to the frontend as we go.
updatedState
<-
evaluate
state
(
Chars
.
unpack
code
)
publish
updatedState
<-
evaluate
state
(
unpack
code
)
publish
-- Notify the frontend that we're done computing.
idleHeader
<-
liftIO
$
dupHeader
replyHeader
StatusMessage
...
...
@@ -328,16 +330,16 @@ replyTo interface req@ExecuteRequest{ getCode = code } replyHeader state = do
replyTo
_
req
@
CompleteRequest
{}
replyHeader
state
=
do
let
line
=
Chars
.
unpack
$
getCodeLine
req
(
matchedText
,
completions
)
<-
complete
line
(
getCursorPos
req
)
let
line
=
getCodeLine
req
(
matchedText
,
completions
)
<-
complete
(
unpack
line
)
(
getCursorPos
req
)
let
reply
=
CompleteReply
replyHeader
completions
matchedText
line
True
let
reply
=
CompleteReply
replyHeader
(
map
pack
completions
)
(
pack
matchedText
)
line
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
oname
docs
<-
pack
<$>
info
(
unpack
oname
)
let
reply
=
ObjectInfoReply
{
header
=
replyHeader
,
objectName
=
oname
,
...
...
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