You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Currently custom Setup.hs scripts are compiled and linked into an executable, which is then executed. On many platforms (e.g. Windows) this can be a considerable fraction of the overall package build time due to the high cost of linking.
Ideally we would rather use the bytecode interpreter to execute such one-off executables. I am aware of two reasons why this hasn't been done in the past:
the bytecode interpreter has historically supported only a subset of the Haskell language (e.g. lacking support for unboxed tuples).
the only convenient way to run a script using the bytecode interpreter is via runghc, which Cabal has no way of reliably locating
With the 9.2 release, GHC's bytecode interpreter will support all Haskell constructs, eliminating the first of these considerations. To eliminate the second I propose that we introduce a new --run mode to GHC. This would be similar to the existing --eval mode, but specialised the use-case of executing a script. For instance, Cabal might run run:
ghc --run Setup.hs -- configure
Thoughts?
Reacted by Emily Pillmore, George Thomas and Artem Pelenitsyn
Whether it's worth investing time into supporting build-type: Custom is another question. With Kmett-verse (#3788) migrated away from it, are they still common in usual install plans?
Reacted by Mikolaj Konarski, Emily Pillmore and Mann mit Hut
Activity
phadej commentedon May 12, 2021
I think
--runis a good idea to have in GHC.Whether it's worth investing time into supporting
build-type: Customis another question. With Kmett-verse (#3788) migrated away from it, are they still common in usual install plans?Mikolaj commentedon May 13, 2021
Why not do both: add
--runto GHC and then remove the need for it in cabal.I suppose
--runis an obviously useful extension on its own and with some publicity would be picked up by other, nameless, tools.