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
3f363ac8
Unverified
Commit
3f363ac8
authored
Jul 12, 2021
by
David Davó
Committed by
GitHub
Jul 12, 2021
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'gibiansky:master' into master
parents
dff65fff
9f9ceca8
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
24 additions
and
113 deletions
+24
-113
ihaskell.cabal
ihaskell.cabal
+1
-1
release-9.0.nix
release-9.0.nix
+3
-110
Evaluate.hs
src/IHaskell/Eval/Evaluate.hs
+9
-0
Hoogle.hs
src/IHaskell/Eval/Hoogle.hs
+2
-2
Parser.hs
src/IHaskell/Eval/Parser.hs
+2
-0
StringUtils.hs
src/StringUtils.hs
+7
-0
No files found.
ihaskell.cabal
View file @
3f363ac8
...
@@ -7,7 +7,7 @@ name: ihaskell
...
@@ -7,7 +7,7 @@ name: ihaskell
-- PVP summary: +--+------- breaking API changes
-- PVP summary: +--+------- breaking API changes
-- | | +----- non-breaking API additions
-- | | +----- non-breaking API additions
-- | | | +--- code changes with no API change
-- | | | +--- code changes with no API change
version: 0.10.2.
0
version: 0.10.2.
1
-- A short (one-line) description of the package.
-- A short (one-line) description of the package.
synopsis: A Haskell backend kernel for the IPython project.
synopsis: A Haskell backend kernel for the IPython project.
...
...
release-9.0.nix
View file @
3f363ac8
let
let
nixpkgs-src
=
builtins
.
fetchTarball
{
nixpkgs-src
=
builtins
.
fetchTarball
{
url
=
"https://github.com/NixOS/nixpkgs/tarball/
5d4dc79acbb98f935f55fec733c16c0d730cbdeb
"
;
url
=
"https://github.com/NixOS/nixpkgs/tarball/
4869c88626382a01ed59b161afe99d9e164bd8a1
"
;
sha256
=
"
197h9bqsjl0na7nfvkll587pjx7vwd3jswab73wxlkcbwx4j66zf
"
;
sha256
=
"
03ncnw0p28j5jsp5dh66jl003x81jhkh2larwkq3fvsbkai4x0kn
"
;
};
};
in
in
{
compiler
?
"ghc901"
{
compiler
?
"ghc901"
...
@@ -12,111 +12,4 @@ in
...
@@ -12,111 +12,4 @@ in
,
rtsopts
?
"-M3g -N2"
,
rtsopts
?
"-M3g -N2"
,
systemPackages
?
(
_
:
[])
,
systemPackages
?
(
_
:
[])
}:
}:
import
(
./release.nix
)
{
inherit
compiler
jupyterlabAppDir
nixpkgs
packages
pythonPackages
rtsopts
systemPackages
;
}
let
inherit
(
builtins
)
any
elem
filterSource
listToAttrs
;
lib
=
nixpkgs
.
lib
;
cleanSource
=
name
:
type
:
let
baseName
=
baseNameOf
(
toString
name
);
in
lib
.
cleanSourceFilter
name
type
&&
!
(
(
type
==
"directory"
&&
(
elem
baseName
[
".stack-work"
"dist"
]))
||
any
(
lib
.
flip
lib
.
hasSuffix
baseName
)
[
".hi"
".ipynb"
".nix"
".sock"
".yaml"
".yml"
]
);
ihaskellSourceFilter
=
src
:
name
:
type
:
let
relPath
=
lib
.
removePrefix
(
toString
src
+
"/"
)
(
toString
name
);
in
cleanSource
name
type
&&
(
any
(
lib
.
flip
lib
.
hasPrefix
relPath
)
[
"src"
"main"
"html"
"Setup.hs"
"ihaskell.cabal"
"LICENSE"
]);
ihaskell-src
=
filterSource
(
ihaskellSourceFilter
./.
)
./.
;
ipython-kernel-src
=
filterSource
cleanSource
./ipython-kernel
;
ghc-parser-src
=
filterSource
cleanSource
./ghc-parser
;
ihaskell-display-src
=
filterSource
cleanSource
./ihaskell-display
;
displays
=
self
:
listToAttrs
(
map
(
display
:
{
name
=
"ihaskell-
${
display
}
"
;
value
=
self
.
callCabal2nix
display
"
${
ihaskell-display-src
}
/ihaskell-
${
display
}
"
{};
})
[
"aeson"
"blaze"
"charts"
"diagrams"
"gnuplot"
"graphviz"
"hatex"
"juicypixels"
"magic"
"plot"
"rlangqq"
"static-canvas"
"widgets"
]);
haskellPackages
=
nixpkgs
.
haskell
.
packages
.
"
${
compiler
}
"
.
override
(
old
:
{
overrides
=
nixpkgs
.
lib
.
composeExtensions
(
old
.
overrides
or
(
_
:
_
:
{}))
(
self
:
super
:
{
ihaskell
=
nixpkgs
.
haskell
.
lib
.
overrideCabal
(
self
.
callCabal2nix
"ihaskell"
ihaskell-src
{})
(
_drv
:
{
preCheck
=
''
export HOME=$TMPDIR/home
export PATH=$PWD/dist/build/ihaskell:$PATH
export GHC_PACKAGE_PATH=$PWD/dist/package.conf.inplace/:$GHC_PACKAGE_PATH
''
;
configureFlags
=
(
_drv
.
configureFlags
or
[])
++
[
# otherwise the tests are agonisingly slow and the kernel times out
"--enable-executable-dynamic"
];
doHaddock
=
false
;
});
ghc-parser
=
self
.
callCabal2nix
"ghc-parser"
ghc-parser-src
{};
ipython-kernel
=
self
.
callCabal2nix
"ipython-kernel"
ipython-kernel-src
{};
inline-r
=
nixpkgs
.
haskell
.
lib
.
dontCheck
super
.
inline-r
;
static-canvas
=
nixpkgs
.
haskell
.
lib
.
doJailbreak
super
.
static-canvas
;
cryptohash-md5
=
nixpkgs
.
haskell
.
lib
.
doJailbreak
super
.
cryptohash-md5
;
cryptohash-sha1
=
nixpkgs
.
haskell
.
lib
.
doJailbreak
super
.
cryptohash-sha1
;
memory
=
nixpkgs
.
haskell
.
lib
.
appendPatch
(
nixpkgs
.
haskell
.
lib
.
doJailbreak
super
.
memory
)
(
nixpkgs
.
fetchpatch
{
url
=
"https://gitlab.haskell.org/ghc/head.hackage/-/raw/c89c1e27af8f180b3be476e102147557f922b224/patches/memory-0.15.0.patch"
;
sha256
=
"0mkjbrzi05h1xds8rf5wfky176hrl03q0d7ipklp9x4ls3yyqj5x"
;
});
cryptonite
=
nixpkgs
.
haskell
.
lib
.
appendPatch
super
.
cryptonite
(
nixpkgs
.
fetchpatch
{
url
=
"https://gitlab.haskell.org/ghc/head.hackage/-/raw/6a65307bbdc73c5eb4165a67ee97c7b9faa818e1/patches/cryptonite-0.28.patch"
;
sha256
=
"1wq9hw16qj2yqy7lyqbi7106lhk199hvnkj5xr7h0ip854gjsr5j"
;
});
profunctors
=
self
.
profunctors_5_6_2
;
mono-traversable
=
nixpkgs
.
haskell
.
lib
.
dontCheck
super
.
mono-traversable
;
}
//
displays
self
);
});
ihaskellEnv
=
haskellPackages
.
ghcWithPackages
(
self
:
[
self
.
ihaskell
]
++
packages
self
);
jupyterlab
=
nixpkgs
.
python3
.
withPackages
(
ps
:
[
ps
.
jupyterlab
]
++
pythonPackages
ps
);
ihaskellWrapperSh
=
nixpkgs
.
writeScriptBin
"ihaskell-wrapper"
''
#!
${
nixpkgs
.
stdenv
.
shell
}
export GHC_PACKAGE_PATH="$(echo
${
ihaskellEnv
}
/lib/*/package.conf.d|
${
nixpkgs
.
coreutils
}
/bin/tr ' ' ':'):$GHC_PACKAGE_PATH"
export PATH="
${
nixpkgs
.
lib
.
makeBinPath
([
ihaskellEnv
jupyterlab
]
++
systemPackages
nixpkgs
)
}
''$
{PATH:+:}$PATH"
exec
${
ihaskellEnv
}
/bin/ihaskell "$@"
''
;
ihaskellJupyterCmdSh
=
cmd
:
extraArgs
:
nixpkgs
.
writeScriptBin
"ihaskell-
${
cmd
}
"
''
#!
${
nixpkgs
.
stdenv
.
shell
}
export GHC_PACKAGE_PATH="$(echo
${
ihaskellEnv
}
/lib/*/package.conf.d|
${
nixpkgs
.
coreutils
}
/bin/tr ' ' ':'):$GHC_PACKAGE_PATH"
export PATH="
${
nixpkgs
.
lib
.
makeBinPath
([
ihaskellEnv
jupyterlab
]
++
systemPackages
nixpkgs
)
}
''$
{PATH:+:}$PATH"
${
ihaskellEnv
}
/bin/ihaskell install \
-l $(
${
ihaskellEnv
}
/bin/ghc --print-libdir) \
--use-rtsopts="
${
rtsopts
}
" \
&&
${
jupyterlab
}
/bin/jupyter
${
cmd
}
${
extraArgs
}
"$@"
''
;
appDir
=
if
jupyterlabAppDir
!=
null
then
"--app-dir=
${
jupyterlabAppDir
}
"
else
""
;
in
nixpkgs
.
buildEnv
{
name
=
"ihaskell-with-packages"
;
buildInputs
=
[
nixpkgs
.
makeWrapper
];
paths
=
[
ihaskellEnv
jupyterlab
];
postBuild
=
''
ln -s
${
ihaskellJupyterCmdSh
"lab"
appDir
}
/bin/ihaskell-lab $out/bin/
ln -s
${
ihaskellJupyterCmdSh
"notebook"
""
}
/bin/ihaskell-notebook $out/bin/
ln -s
${
ihaskellJupyterCmdSh
"nbconvert"
""
}
/bin/ihaskell-nbconvert $out/bin/
ln -s
${
ihaskellJupyterCmdSh
"console"
"--kernel=haskell"
}
/bin/ihaskell-console $out/bin/
for prg in $out/bin"/"*;do
if [[ -f $prg && -x $prg ]]; then
wrapProgram $prg --set PYTHONPATH "$(echo
${
jupyterlab
}
/lib/*/site-packages)"
fi
done
''
;
passthru
=
{
inherit
haskellPackages
;
inherit
ihaskellEnv
;
inherit
jupyterlab
;
inherit
ihaskellJupyterCmdSh
;
inherit
ihaskellWrapperSh
;
ihaskellJsFile
=
./.
+
"/html/kernel.js"
;
ihaskellLogo64
=
./.
+
"/html/logo-64x64.svg"
;
};
}
src/IHaskell/Eval/Evaluate.hs
View file @
3f363ac8
...
@@ -677,6 +677,15 @@ evalCommand _ (Directive GetKind expr) state = wrapExecution state $ do
...
@@ -677,6 +677,15 @@ evalCommand _ (Directive GetKind expr) state = wrapExecution state $ do
let
typeStr
=
showSDocUnqual
flags
$
ppr
kind
let
typeStr
=
showSDocUnqual
flags
$
ppr
kind
return
$
formatType
$
expr
++
" :: "
++
typeStr
return
$
formatType
$
expr
++
" :: "
++
typeStr
evalCommand
_
(
Directive
GetKindBang
expr
)
state
=
wrapExecution
state
$
do
write
state
$
"Kind!: "
++
expr
(
typ
,
kind
)
<-
GHC
.
typeKind
True
expr
flags
<-
getSessionDynFlags
let
kindStr
=
text
expr
<+>
dcolon
<+>
ppr
kind
let
typeStr
=
equals
<+>
ppr
typ
let
finalStr
=
showSDocUnqual
flags
$
vcat
[
kindStr
,
typeStr
]
return
$
formatType
finalStr
evalCommand
_
(
Directive
LoadFile
names
)
state
=
wrapExecution
state
$
do
evalCommand
_
(
Directive
LoadFile
names
)
state
=
wrapExecution
state
$
do
write
state
$
"Load: "
++
names
write
state
$
"Load: "
++
names
...
...
src/IHaskell/Eval/Hoogle.hs
View file @
3f363ac8
...
@@ -25,7 +25,7 @@ import Data.Vector (toList)
...
@@ -25,7 +25,7 @@ import Data.Vector (toList)
import
Network.HTTP.Client
import
Network.HTTP.Client
import
Network.HTTP.Client.TLS
import
Network.HTTP.Client.TLS
import
StringUtils
(
replace
,
split
,
strip
)
import
StringUtils
(
replace
,
split
,
s
plitFirst
,
s
trip
)
-- | Types of formats to render output to.
-- | Types of formats to render output to.
data
OutputFormat
=
Plain
-- ^ Render to plain text.
data
OutputFormat
=
Plain
-- ^ Render to plain text.
...
@@ -193,7 +193,7 @@ renderSelf string loc
...
@@ -193,7 +193,7 @@ renderSelf string loc
packageSub
package
packageSub
package
|
otherwise
=
|
otherwise
=
let
[
name
,
args
]
=
split
"::"
string
let
[
name
,
args
]
=
split
First
"::"
string
package
=
extractPackageName
loc
package
=
extractPackageName
loc
modname
=
extractModuleName
loc
modname
=
extractModuleName
loc
in
span
"hoogle-name"
in
span
"hoogle-name"
...
...
src/IHaskell/Eval/Parser.hs
View file @
3f363ac8
...
@@ -62,6 +62,7 @@ data DirectiveType = GetType -- ^ Get the type of an expression via ':type'
...
@@ -62,6 +62,7 @@ data DirectiveType = GetType -- ^ Get the type of an expression via ':type'
|
SearchHoogle
-- ^ Search for something via Hoogle.
|
SearchHoogle
-- ^ Search for something via Hoogle.
|
GetDoc
-- ^ Get documentation for an identifier via Hoogle.
|
GetDoc
-- ^ Get documentation for an identifier via Hoogle.
|
GetKind
-- ^ Get the kind of a type via ':kind'.
|
GetKind
-- ^ Get the kind of a type via ':kind'.
|
GetKindBang
-- ^ Get the kind and normalised type via ':kind!'.
|
LoadModule
-- ^ Load and unload modules via ':module'.
|
LoadModule
-- ^ Load and unload modules via ':module'.
|
SPrint
-- ^ Print without evaluating via ':sprint'.
|
SPrint
-- ^ Print without evaluating via ':sprint'.
deriving
(
Show
,
Eq
)
deriving
(
Show
,
Eq
)
...
@@ -277,6 +278,7 @@ parseDirective (':':directive) ln =
...
@@ -277,6 +278,7 @@ parseDirective (':':directive) ln =
[
(
LoadModule
,
"module"
)
[
(
LoadModule
,
"module"
)
,
(
GetType
,
"type"
)
,
(
GetType
,
"type"
)
,
(
GetKind
,
"kind"
)
,
(
GetKind
,
"kind"
)
,
(
GetKindBang
,
"kind!"
)
,
(
GetInfo
,
"info"
)
,
(
GetInfo
,
"info"
)
,
(
SearchHoogle
,
"hoogle"
)
,
(
SearchHoogle
,
"hoogle"
)
,
(
GetDoc
,
"documentation"
)
,
(
GetDoc
,
"documentation"
)
...
...
src/StringUtils.hs
View file @
3f363ac8
...
@@ -5,11 +5,13 @@ module StringUtils (
...
@@ -5,11 +5,13 @@ module StringUtils (
rstrip
,
rstrip
,
replace
,
replace
,
split
,
split
,
splitFirst
,
)
where
)
where
import
IHaskellPrelude
import
IHaskellPrelude
import
qualified
Data.Text
as
T
import
qualified
Data.Text
as
T
import
Data.List.Split
(
splitOn
)
import
Data.List.Split
(
splitOn
)
import
qualified
Data.List.Split
as
Split
lstrip
::
String
->
String
lstrip
::
String
->
String
lstrip
=
dropWhile
(`
elem
`
(
"
\t\r\n
"
::
String
))
lstrip
=
dropWhile
(`
elem
`
(
"
\t\r\n
"
::
String
))
...
@@ -26,3 +28,8 @@ replace needle replacement haystack =
...
@@ -26,3 +28,8 @@ replace needle replacement haystack =
split
::
String
->
String
->
[
String
]
split
::
String
->
String
->
[
String
]
split
=
splitOn
split
=
splitOn
splitFirst
::
String
->
String
->
[
String
]
splitFirst
delim
str
=
let
(
head
:
_
:
tail
)
=
Split
.
split
(
Split
.
onSublist
delim
)
str
in
[
head
,
concat
tail
]
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