Skip to content

Allow to define template Haskell dependencies separately #1382

@aherrmann

Description

@aherrmann

Is your feature request related to a problem? Please describe.
Right now Haskell compilation for haskell_library|binary|test, i.e. haskell/private/actions.compile.bzl, requires interface files, object files, and linked libraries of dependencies, as well as direct and transitive C libraries as inputs. The reason is that the target may contain template Haskell code in which case GHC needs to load some of these linked libraries at compile time.

However, in many cases the dependency on linked libraries is not necessary and disables potential build parallelism as well as cache hits if interface files did not change but linked libraries did.

Additionally, the fact that there is no distinction between regular dependencies and template Haskell dependencies prevents us from making runtime dependencies (data attribute) of template Haskell dependencies available during compilation. See #1337 (comment).

Describe the solution you'd like
Add a th_deps attribute to haskell_library|binary|test that allows to distinguish regular and template Haskell dependencies as described above.

Describe alternatives you've considered
In the specific case of data dependencies of template Haskell the issue can be worked around with extra_srcs and CPP as described here.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions