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,28 @@
load(
"@io_tweag_rules_haskell//haskell:haskell.bzl",
"haskell_library",
"haskell_test",
)
package(default_testonly = 1)
haskell_library(
name = "library-deps",
srcs = ["TestLib.hs"],
visibility = ["//visibility:public"],
deps = [
"//tests/hackage:base",
"//tests/library-deps/sublib",
],
)
haskell_test(
name = "bin-deps",
size = "small",
srcs = ["Bin.hs"],
visibility = ["//visibility:public"],
deps = [
"//tests/hackage:base",
"//tests/library-deps/sublib",
],
)

View file

@ -0,0 +1,6 @@
module Main (main) where
import TestSubLib (messageEnd)
main :: IO ()
main = putStrLn $ messageEnd

View file

@ -0,0 +1,9 @@
module TestLib (testMessage) where
import TestSubLib (messageEnd)
testMessage :: String
testMessage = "hello " ++ messageEnd
-- Force dynamic linking
{-# ANN testMessage () #-}

View file

@ -0,0 +1,21 @@
load(
"@io_tweag_rules_haskell//haskell:haskell.bzl",
"haskell_library",
)
package(default_testonly = 1)
haskell_library(
name = "sublib",
srcs = ["TestSubLib.hs"],
visibility = ["//visibility:public"],
deps = [
":sublib-c",
"//tests/hackage:base",
],
)
cc_library(
name = "sublib-c",
srcs = ["sublib-c.c"],
)

View file

@ -0,0 +1,7 @@
{-# LANGUAGE ForeignFunctionInterface #-}
module TestSubLib (messageEnd) where
messageEnd :: String
messageEnd = "world " ++ show (foo 10)
foreign import ccall foo :: Int -> Int

View file

@ -0,0 +1,3 @@
int foo(int x) {
return x * 2;
}