Rules for defining toolchains
Bazel

Rules for defining toolchains


haskell_toolchain

haskell_toolchain(name, version, tools, exec_compatible_with, target_compatible_with, compiler_flags, repl_ghci_args, haddock_flags, locale_archive, **kwargs)

Declare a compiler toolchain.

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

Attributes

name

Name; Required

A unique name for this rule.

version

Unknown; Required

tools

Unknown; Required

exec_compatible_with

Unknown; Optional

target_compatible_with

Unknown; Optional

compiler_flags

List of strings; Optional

repl_ghci_args

List of strings; Optional

haddock_flags

List of strings; Optional

locale_archive

Unknown; Optional

**kwargs

Unknown; Optional

Examples

In a BUILD file:

haskell_toolchain(
    name = "ghc",
    version = "1.2.3",
    tools = "@sys_ghc//:bin",
    compiler_flags = ["-Wall"],
)

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

nixpkgs_package(
    name = 'sys_ghc',
    attribute_path = 'haskell.compiler.ghc822',
)

register_toolchains("//:ghc")

haskell_register_toolchains

haskell_register_toolchains(version)

Download the binary distribution of GHC for your current platform and register it as a toolchain. This currently has the same effect as just haskell_register_ghc_bindists(version).

Attributes

version

Unknown; Required