diff options
author | Vincent Ambo <tazjin@google.com> | 2019-07-04T10·18+0100 |
---|---|---|
committer | Vincent Ambo <tazjin@google.com> | 2019-07-04T10·18+0100 |
commit | f723b8b878a3c4a4687b9e337a875500bebb39b1 (patch) | |
tree | e85204cf042c355e90cff61c111e7d8cd15df311 /third_party/bazel/rules_haskell/tests/hs-boot | |
parent | 2eb1dc26e42ffbdc168f05ef744bd4b4f3e4c36f (diff) |
feat(third_party/bazel): Check in rules_haskell from Tweag r/17
Diffstat (limited to 'third_party/bazel/rules_haskell/tests/hs-boot')
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 |