Support for c2hs

Rules

c2hs_library

Process c2hs source into a Haskell module.

Example usage (generated)

load("@rules_haskell//haskell:c2hs.bzl", "c2hs_library")

c2hs_library(
    # A unique name for this target.
    name = "",
)

name

A unique name for this target.

deps

extra_args

Extra arguments that should be passedto c2hs.

src_strip_prefix

Directory in which module hierarchy starts.

srcs

version

Executable version. If this is specified, CPP version macros will be generated for this build.


Macros and Functions

c2hs_toolchain

Declare a Haskell c2hs toolchain.

You need at least one of these declared somewhere in your BUILD files for the chs_library rule to work. Once declared, you then need to register the toolchain using register_toolchains in your WORKSPACE file (see example below).

Examples

In a BUILD file:

c2hs_toolchain(
    name = "c2hs",
    c2hs = "@c2hs//:bin",
)

where @c2hs is an external repository defined in the WORKSPACE, e.g. using:

nixpkgs_package(
    name = "c2hs",
    attribute_path = "haskell.packages.ghc822.c2hs",
)

register_toolchains("//:c2hs")

Example usage (generated)

load("@rules_haskell//haskell:c2hs.bzl", "c2hs_toolchain")

c2hs_toolchain(
    # A unique name for the toolchain.
    name = "",
    # The c2hs executable.
    c2hs = None,
)

name

A unique name for the toolchain.

c2hs

The c2hs executable.

kwargs

Common rule attributes. See Bazel documentation.