# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under both the MIT license found in the
# LICENSE-MIT file in the root directory of this source tree and the Apache
# License, Version 2.0 found in the LICENSE-APACHE file in the root directory
# of this source tree.
# If the target is a haskell library, the HaskellLibraryProvider
# contains its HaskellLibraryInfo. (in contrast to a HaskellLinkInfo,
# which contains the HaskellLibraryInfo for all the transitive
# dependencies). Direct dependencies are treated differently from
# indirect dependencies for the purposes of module visibility.
HaskellLibraryProvider = provider(
fields = {
"lib": provider_field(typing.Any, default = None), # dict[LinkStyle, HaskellLibraryInfo]
"prof_lib": provider_field(typing.Any, default = None), # dict[LinkStyle, HaskellLibraryInfo]
},
)
# A record of a Haskell library.
HaskellLibraryInfo = record(
# The library target name: e.g. "rts"
name = str,
# package config database: e.g. platform009/build/ghc/lib/package.conf.d
db = Artifact,
# e.g. "base-4.13.0.0"
id = str,
# Import dirs indexed by profiling enabled/disabled
import_dirs = dict[bool, Artifact],
stub_dirs = list[Artifact],
# This field is only used as hidden inputs to compilation, to
# support Template Haskell which may need access to the libraries
# at compile time. The real library flags are propagated up the
# dependency graph via MergedLinkInfo.
libs = field(list[Artifact], []),
# Package version, used to specify the full package when exposing it,
# e.g. filepath-1.4.2.1, deepseq-1.4.4.0.
# Internal packages default to 1.0.0, e.g. `fbcode-dsi-logger-hs-types-1.0.0`.
version = str,
is_prebuilt = bool,
profiling_enabled = bool,
)
HaskellLibraryInfoTSet = transitive_set()