Skip to content

Provide way to retrieve current GHC path in a code generator #10632

Open
@RyanGlScott

Description

@RyanGlScott

Describe the feature request
Currently, there does not appear to be a way to retrieve the path of the current GHC version you are using to build a package in the context of a cabal code generator. As such, in order to programmatically retrieve the GHC path, one has to resort to tricks like what the ghc-paths library does. This is unsatisfying for multiple reasons:

  • ghc-paths requires a custom Setup.hs script. One of the key use cases for cabal code generators is to avoid custom Setup.hs scripts, so needing to depend on a package which uses a custom Setup.hs script in order to use a code generator is unfortunate.
  • ghc-paths's assumptions about where GHC is installed are incorrect if you relocate your GHC installation.

Additional context
I encountered this in the context of goldfirere/singletons#622, in which I replaced singletons-base's custom Setup.hs script with a code generator. While using ghc-paths as part of this solution mostly works, I am missing the ability to completely remove the dependency on custom Setup.hs scripts due to the need for a ghc-paths dependency. (This dependency is only used in the singletons-base test suite, however, so the situation is not as severe as when the entire singletons-base library required a custom Setup.hs script.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions