feat(third_party/bazel): Check in rules_haskell from Tweag
This commit is contained in:
parent
2eb1dc26e4
commit
f723b8b878
479 changed files with 51484 additions and 0 deletions
81
third_party/bazel/rules_haskell/tests/repl-targets/BUILD.bazel
vendored
Normal file
81
third_party/bazel/rules_haskell/tests/repl-targets/BUILD.bazel
vendored
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
load("@io_tweag_rules_haskell//haskell:c2hs.bzl", "c2hs_library")
|
||||
load(
|
||||
"@io_tweag_rules_haskell//haskell:haskell.bzl",
|
||||
"haskell_library",
|
||||
"haskell_test",
|
||||
)
|
||||
|
||||
package(default_testonly = 1)
|
||||
|
||||
genrule(
|
||||
name = "codegen",
|
||||
outs = [
|
||||
"Gen.hs",
|
||||
],
|
||||
cmd = """
|
||||
echo "module Gen (gen) where" >> $(location :Gen.hs)
|
||||
echo "gen :: String" >> $(location :Gen.hs)
|
||||
echo "gen = \\"gen\\"" >> $(location :Gen.hs)
|
||||
""",
|
||||
)
|
||||
|
||||
c2hs_library(
|
||||
name = "chs",
|
||||
srcs = ["Chs.chs"],
|
||||
tags = ["requires_c2hs"],
|
||||
)
|
||||
|
||||
haskell_library(
|
||||
name = "hs-lib",
|
||||
srcs = [
|
||||
"Foo.hs",
|
||||
"Hsc.hsc",
|
||||
":chs",
|
||||
":codegen",
|
||||
],
|
||||
tags = [
|
||||
"requires_hackage",
|
||||
"requires_zlib",
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//tests/data:ourclibrary",
|
||||
"//tests/hackage:array",
|
||||
"//tests/hackage:base",
|
||||
"@zlib",
|
||||
],
|
||||
)
|
||||
|
||||
haskell_library(
|
||||
name = "hs-lib-bad",
|
||||
srcs = [
|
||||
"Bad.hs",
|
||||
],
|
||||
tags = [
|
||||
"manual",
|
||||
"requires_zlib",
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//tests/data:ourclibrary",
|
||||
"//tests/hackage:base",
|
||||
"@hackage//:array",
|
||||
"@zlib",
|
||||
],
|
||||
)
|
||||
|
||||
haskell_library(
|
||||
name = "QuuxLib",
|
||||
srcs = ["QuuxLib.hs"],
|
||||
deps = ["//tests/hackage:base"],
|
||||
)
|
||||
|
||||
haskell_test(
|
||||
name = "hs-bin",
|
||||
srcs = ["Quux.hs"],
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
":QuuxLib",
|
||||
"//tests/hackage:base",
|
||||
],
|
||||
)
|
||||
6
third_party/bazel/rules_haskell/tests/repl-targets/Bad.hs
vendored
Normal file
6
third_party/bazel/rules_haskell/tests/repl-targets/Bad.hs
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
module Bad
|
||||
( bad )
|
||||
where
|
||||
|
||||
bad :: Into
|
||||
bad = "foo"
|
||||
6
third_party/bazel/rules_haskell/tests/repl-targets/Chs.chs
vendored
Normal file
6
third_party/bazel/rules_haskell/tests/repl-targets/Chs.chs
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
module Chs
|
||||
( baz )
|
||||
where
|
||||
|
||||
baz :: String
|
||||
baz = "baz"
|
||||
9
third_party/bazel/rules_haskell/tests/repl-targets/Foo.hs
vendored
Normal file
9
third_party/bazel/rules_haskell/tests/repl-targets/Foo.hs
vendored
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
{-# LANGUAGE ForeignFunctionInterface #-}
|
||||
|
||||
module Foo (foo) where
|
||||
|
||||
foreign import ccall "c_add_one"
|
||||
c_add_one :: Int -> Int
|
||||
|
||||
foo :: Int -> Int
|
||||
foo = (+ 5) . c_add_one
|
||||
8
third_party/bazel/rules_haskell/tests/repl-targets/Hsc.hsc
vendored
Normal file
8
third_party/bazel/rules_haskell/tests/repl-targets/Hsc.hsc
vendored
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
module Hsc
|
||||
( bar )
|
||||
where
|
||||
|
||||
#ifndef _INTERNAL_HSC_DO_NOT_DEFINE_ME
|
||||
bar :: String
|
||||
bar = "bar"
|
||||
#endif
|
||||
6
third_party/bazel/rules_haskell/tests/repl-targets/Quux.hs
vendored
Normal file
6
third_party/bazel/rules_haskell/tests/repl-targets/Quux.hs
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
module Main (main) where
|
||||
|
||||
import QuuxLib (message)
|
||||
|
||||
main :: IO ()
|
||||
main = putStrLn message
|
||||
4
third_party/bazel/rules_haskell/tests/repl-targets/QuuxLib.hs
vendored
Normal file
4
third_party/bazel/rules_haskell/tests/repl-targets/QuuxLib.hs
vendored
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
module QuuxLib (message) where
|
||||
|
||||
message :: String
|
||||
message = "Hello GHCi!"
|
||||
4
third_party/bazel/rules_haskell/tests/repl-targets/src/Bar.hs
vendored
Normal file
4
third_party/bazel/rules_haskell/tests/repl-targets/src/Bar.hs
vendored
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
module Bar (bar) where
|
||||
|
||||
bar :: Int
|
||||
bar = 4
|
||||
4
third_party/bazel/rules_haskell/tests/repl-targets/src/Baz.hsc
vendored
Normal file
4
third_party/bazel/rules_haskell/tests/repl-targets/src/Baz.hsc
vendored
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
module Baz (baz) where
|
||||
|
||||
baz :: Int
|
||||
baz = 8
|
||||
Loading…
Add table
Add a link
Reference in a new issue