summaryrefslogtreecommitdiff
path: root/Biz/Ide/repl
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2021-12-21 18:48:16 -0500
committerBen Sima <ben@bsima.me>2021-12-21 18:48:16 -0500
commit8e2eede487b24908c89d60bce272e4269135e4ec (patch)
treeb35467c72efe19b0d62e56abcc2aefe0840ccc42 /Biz/Ide/repl
parentc28c544b933cfb3ef3152be922248e9bbe89811e (diff)
Extract repl program from bild
This is basically building on top of bild's analysis, which is great becuase it means that bild is becoming a useful tool rather than a monolithic do-everything job runner. The eventual goal is for the bild analysis to be much more useful, maybe even provide data to remote repls or language-server or whatever.
Diffstat (limited to 'Biz/Ide/repl')
-rwxr-xr-xBiz/Ide/repl20
1 files changed, 20 insertions, 0 deletions
diff --git a/Biz/Ide/repl b/Biz/Ide/repl
new file mode 100755
index 0000000..79e7875
--- /dev/null
+++ b/Biz/Ide/repl
@@ -0,0 +1,20 @@
+#!/usr/bin/env bash
+#
+# a simple complement to bild which only deals with launching repls
+#
+# > repl <target>
+#
+# Starts a repl/shell for target.
+#
+# - if target.hs, load ghci
+# - TODO: if target.scm, load scheme repl
+# - TODO: if target.nix, load nix-shell
+##
+ set -e
+ target=${1:?}
+ json=$(bild --json $1)
+ langdeps=$(jq --raw-output '.[].langdeps | join(" ")' <<< $json)
+ nix-shell \
+ --packages "(import $BIZ_ROOT/Biz/Bild.nix {}).ghcWith (h: with h; [$langdeps])" \
+ --command "ghci -i$BIZ_ROOT -ghci-script $BIZ_ROOT/.ghci $target"
+##