feat(third_party/bazel): Check in rules_haskell from Tweag

This commit is contained in:
Vincent Ambo 2019-07-04 11:18:12 +01:00
parent 2eb1dc26e4
commit f723b8b878
479 changed files with 51484 additions and 0 deletions

View file

@ -0,0 +1,2 @@
module A where
newtype TA = MkTA Int

View file

@ -0,0 +1,8 @@
module A where
import B (TB (..))
newtype TA = MkTA Int
f :: TB -> TA
f (MkTB x) = MkTA x

View file

@ -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",
],
)

View file

@ -0,0 +1,8 @@
module MA where
import MB (TB (..))
newtype TA = MkTA Int
f :: TB -> TA
f (MkTB x) = MkTA x

View file

@ -0,0 +1,2 @@
module MA where
newtype TA = MkTA Int

View file

@ -0,0 +1,8 @@
module MB where
import {-# SOURCE #-} MA (TA (..))
data TB = MkTB !Int
g :: TA -> TB
g (MkTA x) = MkTB x

View file

@ -0,0 +1,9 @@
module Main (main) where
import A ()
import B ()
import MA ()
import MB ()
main :: IO ()
main = putStrLn "hsboot"

View file

@ -0,0 +1,8 @@
module B where
import {-# SOURCE #-} A (TA (..))
data TB = MkTB !Int
g :: TA -> TB
g (MkTA x) = MkTB x