author | wenzelm |
Sat, 15 Dec 2018 16:42:18 +0100 | |
changeset 69473 | f71598c11fae |
parent 69459 | bbb61a9cb99a |
child 69662 | fd86ed39aea4 |
permissions | -rw-r--r-- |
69241 | 1 |
(* Title: Tools/Haskell/Test.thy |
69225 | 2 |
Author: Makarius |
3 |
*) |
|
4 |
||
69241 | 5 |
section \<open>Test build of Isabelle/Haskell modules\<close> |
69225 | 6 |
|
69241 | 7 |
theory Test imports Haskell |
69225 | 8 |
begin |
9 |
||
69239
6cd985a78d6e
support sub-directories, i.e. structure module names;
wenzelm
parents:
69225
diff
changeset
|
10 |
ML \<open> |
69444
c3c9440cbf9b
more formal Haskell project setup, with dependencies on packages from "stackage";
wenzelm
parents:
69385
diff
changeset
|
11 |
Isabelle_System.with_tmp_dir "ghc" (fn tmp_dir => |
69225 | 12 |
let |
69444
c3c9440cbf9b
more formal Haskell project setup, with dependencies on packages from "stackage";
wenzelm
parents:
69385
diff
changeset
|
13 |
val src_dir = Path.append tmp_dir (Path.explode "src"); |
c3c9440cbf9b
more formal Haskell project setup, with dependencies on packages from "stackage";
wenzelm
parents:
69385
diff
changeset
|
14 |
val files = Generated_Files.write_files \<^theory>\<open>Haskell\<close> src_dir; |
c3c9440cbf9b
more formal Haskell project setup, with dependencies on packages from "stackage";
wenzelm
parents:
69385
diff
changeset
|
15 |
|
c3c9440cbf9b
more formal Haskell project setup, with dependencies on packages from "stackage";
wenzelm
parents:
69385
diff
changeset
|
16 |
val modules = files |
c3c9440cbf9b
more formal Haskell project setup, with dependencies on packages from "stackage";
wenzelm
parents:
69385
diff
changeset
|
17 |
|> map (Path.implode #> unsuffix ".hs" #> space_explode "/" #> space_implode "."); |
69446 | 18 |
val _ = |
19 |
GHC.new_project tmp_dir |
|
69453 | 20 |
{name = "isabelle", |
69473 | 21 |
depends = |
22 |
["bytestring", "containers", "network", "split", "threads", "utf8-string", "uuid"], |
|
69453 | 23 |
modules = modules}; |
69444
c3c9440cbf9b
more formal Haskell project setup, with dependencies on packages from "stackage";
wenzelm
parents:
69385
diff
changeset
|
24 |
|
69225 | 25 |
val (out, rc) = |
26 |
Isabelle_System.bash_output |
|
69444
c3c9440cbf9b
more formal Haskell project setup, with dependencies on packages from "stackage";
wenzelm
parents:
69385
diff
changeset
|
27 |
(cat_lines ["set -e", "cd " ^ File.bash_path tmp_dir, "isabelle ghc_stack build 2>&1"]); |
69239
6cd985a78d6e
support sub-directories, i.e. structure module names;
wenzelm
parents:
69225
diff
changeset
|
28 |
in if rc = 0 then writeln out else error out end) |
69225 | 29 |
\<close> |
30 |
||
31 |
end |