aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Smeding <tom@tomsmeding.com>2025-01-06 21:39:53 +0100
committerTom Smeding <tom@tomsmeding.com>2025-01-06 21:39:53 +0100
commit3b215d80b5e8f1271a7076a24e6a5a4353154246 (patch)
tree2969f40903ce98d08f24d4c4817a25521c175093
parentdb075620db9e9da77276f0999b9cb09502920ab3 (diff)
Better implementation of :versionHEADmaster
Thanks geekosaur :)
-rwxr-xr-xbwrap-files/workdir/entry.sh3
-rw-r--r--src/Ghci.hs13
2 files changed, 2 insertions, 14 deletions
diff --git a/bwrap-files/workdir/entry.sh b/bwrap-files/workdir/entry.sh
index 436ba64..61c09d5 100755
--- a/bwrap-files/workdir/entry.sh
+++ b/bwrap-files/workdir/entry.sh
@@ -14,9 +14,6 @@ else
versionargs=()
fi
-# Inform yahb2 about the GHC version we're using
-echo "yahb2-ghci-version=$($ghcup run "${versionargs[@]}" -- ghci --numeric-version)"
-
$ghcup run "${versionargs[@]}" -- ghci Yahb2Defs.hs 2>&1
# vim: set sw=2 ts=8 et:
diff --git a/src/Ghci.hs b/src/Ghci.hs
index ae3bac9..dbd901b 100644
--- a/src/Ghci.hs
+++ b/src/Ghci.hs
@@ -47,7 +47,6 @@ data Ghci = Ghci
{ ghciProc :: ProcessHandle
, ghciStdin :: Handle
, ghciStdout :: Handle
- , ghciVersion :: String
}
data ParseSettings = ParseSettings
@@ -75,21 +74,13 @@ makeGhci = do
, std_out = UseHandle pipeIn
, std_err = UseHandle pipeIn }
- versionLine <- hGetLine pipeOut
- let version
- | take 19 versionLine == "yahb2-ghci-version=" =
- takeWhile (not . isSpace) (drop 19 versionLine)
- | otherwise =
- "<unknown, sorry>"
-
ghciPutStrLn stdinH ":set -interactive-print=Yahb2Defs.limitedPrint"
ghciPutStrLn stdinH ":m"
ghciPutStrLn stdinH ":script initdefs.hs"
hFlush stdinH
return Ghci { ghciProc = proch
, ghciStdin = stdinH
- , ghciStdout = pipeOut
- , ghciVersion = version }
+ , ghciStdout = pipeOut }
runStmtClever :: Ghci -> ParseSettings -> String -> IO (Ghci, Result String)
runStmtClever ghci pset line =
@@ -109,7 +100,7 @@ runStmtClever ghci pset line =
| cmd == "version" ->
-- no startsWith because :version is not a ghci command, and we
-- don't want to shadow other actual ghci commands
- return (ghci, Return (ghciVersion ghci))
+ runStmt ghci pset "Prelude.putStrLn (Data.List.intercalate \".\" (Prelude.map Prelude.show (Data.Version.versionBranch System.Info.fullCompilerVersion)))"
_ -> runStmt ghci pset line
_ -> runStmt ghci pset line
where