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

View file

@ -0,0 +1,6 @@
module Bad
( bad )
where
bad :: Into
bad = "foo"

View file

@ -0,0 +1,6 @@
module Chs
( baz )
where
baz :: String
baz = "baz"

View 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

View file

@ -0,0 +1,8 @@
module Hsc
( bar )
where
#ifndef _INTERNAL_HSC_DO_NOT_DEFINE_ME
bar :: String
bar = "bar"
#endif

View file

@ -0,0 +1,6 @@
module Main (main) where
import QuuxLib (message)
main :: IO ()
main = putStrLn message

View file

@ -0,0 +1,4 @@
module QuuxLib (message) where
message :: String
message = "Hello GHCi!"

View file

@ -0,0 +1,4 @@
module Bar (bar) where
bar :: Int
bar = 4

View file

@ -0,0 +1,4 @@
module Baz (baz) where
baz :: Int
baz = 8