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
f159fca4
Commit
f159fca4
authored
Oct 28, 2013
by
Adam Vogt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix #21 by ignoring stuff after each valid int
parent
0b63c0ce
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
1 deletion
+15
-1
IPython.hs
IHaskell/IPython.hs
+15
-1
No files found.
IHaskell/IPython.hs
View file @
f159fca4
...
...
@@ -5,6 +5,7 @@ module IHaskell.IPython (
)
where
import
ClassyPrelude
import
Prelude
(
reads
)
import
Shelly
hiding
(
find
,
trace
)
import
Text.Printf
import
System.Argv0
...
...
@@ -36,9 +37,22 @@ ipythonVersion = shelly $ do
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
]
[
major
,
minor
,
patch
]
<-
parseVersion
<$>
runHandle
path
[
"--version"
]
(
liftIO
.
StrictIO
.
hGetContents
)
::
Sh
[
Int
]
return
(
major
,
minor
,
patch
)
{- |
>>> parseVersion `map` ["2.0.0-dev", "2.0.0-alpha", "12.5.10"]
[[2,0,0],[2,0,0],[12,5,10]]
-}
parseVersion
::
String
->
[
Int
]
parseVersion
versionStr
=
map
read'
$
split
"."
versionStr
where
read'
x
=
case
reads
x
of
[(
n
,
_
)]
->
n
_
->
error
$
"cannot parse version: "
++
versionStr
-- | Run an IHaskell application using the given profile.
runIHaskell
::
String
-- ^ IHaskell profile name.
->
String
-- ^ IPython app name.
...
...
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