support for GHC via command-line tools;
authorwenzelm
Wed, 17 Oct 2018 21:38:07 +0200
changeset 69151 b310bc57f55f
parent 69150 545b68843709
child 69152 77eede3f40e2
support for GHC via command-line tools;
NEWS
etc/settings
lib/Tools/ghc
lib/Tools/ghc_setup
lib/Tools/ghc_stack
lib/Tools/ghci
lib/scripts/getsettings
--- a/NEWS	Wed Oct 17 21:37:40 2018 +0200
+++ b/NEWS	Wed Oct 17 21:38:07 2018 +0200
@@ -95,6 +95,11 @@
 dynamically according the state of ISABELLE_OPAM_ROOT concerning
 ISABELLE_OCAML_VERSION.
 
+* Support for Glasgow Haskell Compiler via command-line tools "isabelle
+ghc_setup", "isabelle ghci", "isabelle ghc", "isabelle ghc_stack".
+Existing settings variable ISABELLE_GHC is maintained dynamically
+according the state of ISABELLE_STACK_ROOT and ISABELLE_STACK_RESOLVER.
+
 
 
 New in Isabelle2018 (August 2018)
--- a/etc/settings	Wed Oct 17 21:37:40 2018 +0200
+++ b/etc/settings	Wed Oct 17 21:38:07 2018 +0200
@@ -147,6 +147,10 @@
 
 ISABELLE_STACK_ROOT="$ISABELLE_HOME_USER/stack"
 
+ISABELLE_STACK_RESOLVER="lts-12.13"
+
+ISABELLE_GHC_VERSION="ghc-8.4.3"
+
 
 ###
 ### Misc settings
@@ -154,7 +158,6 @@
 
 ISABELLE_GNUPLOT="gnuplot"
 
-#ISABELLE_GHC="/usr/bin/ghc"
 #ISABELLE_MLTON="/usr/bin/mlton"
 #ISABELLE_SMLNJ="/usr/bin/sml"
 #ISABELLE_SWIPL="/usr/bin/swipl"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/Tools/ghc	Wed Oct 17 21:38:07 2018 +0200
@@ -0,0 +1,7 @@
+#!/usr/bin/env bash
+#
+# Author: Makarius
+#
+# DESCRIPTION: invoke Glasgow Haskell Compiler within the Isabelle environment
+
+isabelle_stack ghc -- "$@"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/Tools/ghc_setup	Wed Oct 17 21:38:07 2018 +0200
@@ -0,0 +1,8 @@
+#!/usr/bin/env bash
+#
+# Author: Makarius
+#
+# DESCRIPTION: setup Glasgow Haskell Compiler setup via Stack
+
+isabelle_stack setup --resolver "$ISABELLE_STACK_RESOLVER" &&
+  isabelle_stack ghci --ghci-options --version
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/Tools/ghc_stack	Wed Oct 17 21:38:07 2018 +0200
@@ -0,0 +1,7 @@
+#!/usr/bin/env bash
+#
+# Author: Makarius
+#
+# DESCRIPTION: invoke Haskell Tool Stack within the Isabelle environment
+
+isabelle_stack "$@"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/Tools/ghci	Wed Oct 17 21:38:07 2018 +0200
@@ -0,0 +1,7 @@
+#!/usr/bin/env bash
+#
+# Author: Makarius
+#
+# DESCRIPTION: invoke GHC interaction within the Isabelle environment
+
+isabelle_stack ghci "$@"
--- a/lib/scripts/getsettings	Wed Oct 17 21:37:40 2018 +0200
+++ b/lib/scripts/getsettings	Wed Oct 17 21:38:07 2018 +0200
@@ -107,6 +107,11 @@
   ISABELLE_OCAMLC="$ISABELLE_HOME/lib/Tools/ocamlc"
 fi
 
+#GHC
+if [ -z "$ISABELLE_GHC" -a -d "$ISABELLE_STACK_ROOT" -a -f "$(isabelle_stack path --programs)/$ISABELLE_GHC_VERSION/ghc" ]; then
+  ISABELLE_GHC="$ISABELLE_HOME/lib/Tools/ghc"
+fi
+
 #enforce JAVA_HOME
 if [ -d "$ISABELLE_JDK_HOME/jre" ]
 then