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
75b17b55
Commit
75b17b55
authored
Oct 28, 2013
by
Andrew Gibiansky
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Check for IPython version.
parent
13af0ec2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
2 deletions
+27
-2
Evaluate.hs
IHaskell/Eval/Evaluate.hs
+4
-1
IPython.hs
IHaskell/IPython.hs
+17
-1
Main.hs
Main.hs
+6
-0
No files found.
IHaskell/Eval/Evaluate.hs
View file @
75b17b55
...
@@ -23,6 +23,7 @@ import GHC hiding (Stmt)
...
@@ -23,6 +23,7 @@ import GHC hiding (Stmt)
import
GHC.Paths
import
GHC.Paths
import
Exception
hiding
(
evaluate
)
import
Exception
hiding
(
evaluate
)
import
Outputable
import
qualified
System.IO.Strict
as
StrictIO
import
qualified
System.IO.Strict
as
StrictIO
import
IHaskell.Types
import
IHaskell.Types
...
@@ -164,7 +165,9 @@ evalCommand (Statement stmt) = do
...
@@ -164,7 +165,9 @@ evalCommand (Statement stmt) = do
ghandle
handler
$
do
ghandle
handler
$
do
(
printed
,
result
)
<-
capturedStatement
stmt
(
printed
,
result
)
<-
capturedStatement
stmt
case
result
of
case
result
of
RunOk
_
->
RunOk
names
->
do
dflags
<-
getSessionDynFlags
write
$
"Names: "
++
show
(
map
(
showPpr
dflags
)
names
)
return
[
Display
PlainText
printed
]
return
[
Display
PlainText
printed
]
RunException
exception
->
do
RunException
exception
->
do
write
$
"RunException: "
++
show
exception
write
$
"RunException: "
++
show
exception
...
...
IHaskell/IPython.hs
View file @
75b17b55
module
IHaskell.IPython
(
module
IHaskell.IPython
(
runIHaskell
,
runIHaskell
,
setupIPythonProfile
setupIPythonProfile
,
ipythonVersion
)
where
)
where
import
ClassyPrelude
import
ClassyPrelude
...
@@ -9,6 +10,10 @@ import Text.Printf
...
@@ -9,6 +10,10 @@ import Text.Printf
import
System.Argv0
import
System.Argv0
import
System.Directory
import
System.Directory
import
qualified
Filesystem.Path.CurrentOS
as
FS
import
qualified
Filesystem.Path.CurrentOS
as
FS
import
Data.List.Utils
(
split
)
import
Prelude
(
read
)
import
qualified
System.IO.Strict
as
StrictIO
import
qualified
IHaskell.Config
as
Config
import
qualified
IHaskell.Config
as
Config
...
@@ -23,6 +28,17 @@ ipython args = do
...
@@ -23,6 +28,17 @@ ipython args = do
doNothing
_
_
_
=
return
()
doNothing
_
_
_
=
return
()
-- | Use the `ipython --version` command to figure out the version.
-- Return a tuple with (major, minor, patch).
ipythonVersion
::
IO
(
Int
,
Int
,
Int
)
ipythonVersion
=
shelly
$
do
path
<-
which
"ipython"
case
path
of
Nothing
->
error
"Could not find `ipython` executable."
Just
path
->
do
[
major
,
minor
,
patch
]
<-
map
read
<$>
split
"."
<$>
runHandle
path
[
"--version"
]
(
liftIO
.
StrictIO
.
hGetContents
)
::
Sh
[
Int
]
return
(
major
,
minor
,
patch
)
-- | Run an IHaskell application using the given profile.
-- | Run an IHaskell application using the given profile.
runIHaskell
::
String
-- ^ IHaskell profile name.
runIHaskell
::
String
-- ^ IHaskell profile name.
->
String
-- ^ IPython app name.
->
String
-- ^ IPython app name.
...
...
Main.hs
View file @
75b17b55
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
import
ClassyPrelude
hiding
(
liftIO
)
import
ClassyPrelude
hiding
(
liftIO
)
import
Control.Concurrent.Chan
import
Control.Concurrent.Chan
import
Data.Aeson
import
Data.Aeson
import
Text.Printf
import
qualified
Data.Map
as
Map
import
qualified
Data.Map
as
Map
...
@@ -20,6 +21,11 @@ data KernelState = KernelState
...
@@ -20,6 +21,11 @@ data KernelState = KernelState
main
::
IO
()
main
::
IO
()
main
=
do
main
=
do
(
major
,
minor
,
patch
)
<-
ipythonVersion
when
(
major
/=
1
)
$
do
printf
"Expecting IPython version 1.*, found version %d.%d.%d.
\n
"
major
minor
patch
error
"Incorrect ipython --version."
args
<-
map
unpack
<$>
getArgs
args
<-
map
unpack
<$>
getArgs
case
args
of
case
args
of
-- Create the "haskell" profile.
-- Create the "haskell" profile.
...
...
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