Skip to content

GHC as a Stateless Black Box #11822

@zlonast

Description

@zlonast

Proposal

GHC as a Stateless Black Box: Ideally, GHC should have no built-in knowledge of the user's environment.

Build Tools as Context Providers: The build tool (Cabal) acts as the sole source of truth, fully defining the dependency graph via explicit CLI arguments, effectively overriding any implicit GHC defaults.

Isolation as a Build Guarantee: Any attempt by GHC to resolve dependencies outside of the provided flags is technically a violation of the build's isolation.

Motivation

Current GHC architecture relies on "implicit discovery" of the system toolchain (C compiler, linker, etc.). When GHC compiles to machine code, it often relies on hardcoded paths from the settings file or looks up the toolchain in the host's $PATH. This makes GHC a "host-dependent" tool rather than a truly "stateless" one. This leads to non-deterministic behavior where the same build can produce different binaries depending on which version of gcc or ld is present on the host system, completely bypassing the isolation provided by build tools.

Plan (.cabal, cabal.project and cabal ***** --[flags])

  • Pass explicit -*-options flags
  • Pass explicit -pgm* flags
  • Pass explicit -opt* flags
  • Pass explicit -O[n] and -g[n] flags

The list will be expanded

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions