about summary refs log tree commit diff
path: root/third_party/bazel/rules_haskell/tests/hs-boot
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/bazel/rules_haskell/tests/hs-boot')
-rw-r--r--third_party/bazel/rules_haskell/tests/hs-boot/A.hs-boot.in2
-rw-r--r--third_party/bazel/rules_haskell/tests/hs-boot/A.hs.in8
-rw-r--r--third_party/bazel/rules_haskell/tests/hs-boot/BUILD.bazel48
-rw-r--r--third_party/bazel/rules_haskell/tests/hs-boot/MA.hs8
-rw-r--r--third_party/bazel/rules_haskell/tests/hs-boot/MA.hs-boot2
-rw-r--r--third_party/bazel/rules_haskell/tests/hs-boot/MB.hs8
-rw-r--r--third_party/bazel/rules_haskell/tests/hs-boot/Main.hs9
-rw-r--r--third_party/bazel/rules_haskell/tests/hs-boot/srcs/B.hs8
8 files changed, 93 insertions, 0 deletions
diff --git a/third_party/bazel/rules_haskell/tests/hs-boot/A.hs-boot.in b/third_party/bazel/rules_haskell/tests/hs-boot/A.hs-boot.in
new file mode 100644
index 000000000000..02d37ced950f
--- /dev/null
+++ b/third_party/bazel/rules_haskell/tests/hs-boot/A.hs-boot.in
@@ -0,0 +1,2 @@
+module A where
+  newtype TA = MkTA Int
diff --git a/third_party/bazel/rules_haskell/tests/hs-boot/A.hs.in b/third_party/bazel/rules_haskell/tests/hs-boot/A.hs.in
new file mode 100644
index 000000000000..deeff5470b77
--- /dev/null
+++ b/third_party/bazel/rules_haskell/tests/hs-boot/A.hs.in
@@ -0,0 +1,8 @@
+module A where
+
+import B (TB (..))
+
+newtype TA = MkTA Int
+
+f :: TB -> TA
+f (MkTB x) = MkTA x
diff --git a/third_party/bazel/rules_haskell/tests/hs-boot/BUILD.bazel b/third_party/bazel/rules_haskell/tests/hs-boot/BUILD.bazel
new file mode 100644
index 000000000000..4e69da0e6b34
--- /dev/null
+++ b/third_party/bazel/rules_haskell/tests/hs-boot/BUILD.bazel
@@ -0,0 +1,48 @@
+load(
+    "@io_tweag_rules_haskell//haskell:haskell.bzl",
+    "haskell_library",
+    "haskell_test",
+)
+
+package(default_testonly = 1)
+
+genrule(
+    name = "gen-A-boot",
+    srcs = ["A.hs-boot.in"],
+    outs = ["srcs/A.hs-boot"],
+    cmd = "cp $< $@",
+)
+
+genrule(
+    name = "gen-A",
+    srcs = ["A.hs.in"],
+    outs = ["srcs/A.hs"],
+    cmd = "cp $< $@",
+)
+
+haskell_library(
+    name = "hs-boot-lib",
+    srcs = [
+        "srcs/B.hs",
+        ":gen-A",
+        ":gen-A-boot",
+    ],
+    src_strip_prefix = "srcs",
+    visibility = ["//visibility:public"],
+    deps = ["//tests/hackage:base"],
+)
+
+haskell_test(
+    name = "hs-boot",
+    srcs = [
+        "MA.hs",
+        "MA.hs-boot",
+        "MB.hs",
+        "Main.hs",
+    ],
+    visibility = ["//visibility:public"],
+    deps = [
+        ":hs-boot-lib",
+        "//tests/hackage:base",
+    ],
+)
diff --git a/third_party/bazel/rules_haskell/tests/hs-boot/MA.hs b/third_party/bazel/rules_haskell/tests/hs-boot/MA.hs
new file mode 100644
index 000000000000..4e0128596242
--- /dev/null
+++ b/third_party/bazel/rules_haskell/tests/hs-boot/MA.hs
@@ -0,0 +1,8 @@
+module MA where
+
+import MB (TB (..))
+
+newtype TA = MkTA Int
+
+f :: TB -> TA
+f (MkTB x) = MkTA x
diff --git a/third_party/bazel/rules_haskell/tests/hs-boot/MA.hs-boot b/third_party/bazel/rules_haskell/tests/hs-boot/MA.hs-boot
new file mode 100644
index 000000000000..0ab8c899f2e1
--- /dev/null
+++ b/third_party/bazel/rules_haskell/tests/hs-boot/MA.hs-boot
@@ -0,0 +1,2 @@
+module MA where
+  newtype TA = MkTA Int
diff --git a/third_party/bazel/rules_haskell/tests/hs-boot/MB.hs b/third_party/bazel/rules_haskell/tests/hs-boot/MB.hs
new file mode 100644
index 000000000000..d90d041d578e
--- /dev/null
+++ b/third_party/bazel/rules_haskell/tests/hs-boot/MB.hs
@@ -0,0 +1,8 @@
+module MB where
+
+import {-# SOURCE #-} MA (TA (..))
+
+data TB = MkTB !Int
+
+g :: TA -> TB
+g (MkTA x) = MkTB x
diff --git a/third_party/bazel/rules_haskell/tests/hs-boot/Main.hs b/third_party/bazel/rules_haskell/tests/hs-boot/Main.hs
new file mode 100644
index 000000000000..15c0085fe079
--- /dev/null
+++ b/third_party/bazel/rules_haskell/tests/hs-boot/Main.hs
@@ -0,0 +1,9 @@
+module Main (main) where
+
+import A ()
+import B ()
+import MA ()
+import MB ()
+
+main :: IO ()
+main = putStrLn "hsboot"
diff --git a/third_party/bazel/rules_haskell/tests/hs-boot/srcs/B.hs b/third_party/bazel/rules_haskell/tests/hs-boot/srcs/B.hs
new file mode 100644
index 000000000000..60e1ff5f3edd
--- /dev/null
+++ b/third_party/bazel/rules_haskell/tests/hs-boot/srcs/B.hs
@@ -0,0 +1,8 @@
+module B where
+
+import {-# SOURCE #-} A (TA (..))
+
+data TB = MkTB !Int
+
+g :: TA -> TB
+g (MkTA x) = MkTB x