Simon Hengel pushed to branch wip/sol/pp-set-ghc-version at Glasgow Haskell Compiler / GHC
Commits:
-
7e347ecd
by Simon Hengel at 2026-06-20T14:20:54+00:00
1 changed file:
Changes:
| ... | ... | @@ -603,7 +603,7 @@ Options affecting a Haskell pre-processor |
| 603 | 603 | appropriate and useful. The ``-F`` option lets you run a
|
| 604 | 604 | pre-processor as part of the overall GHC compilation pipeline, which
|
| 605 | 605 | has the advantage over running a Haskell pre-processor separately in
|
| 606 | - that it works in interpreted mode and you can continue to take reap
|
|
| 606 | + that it works in interpreted mode and you can continue to reap
|
|
| 607 | 607 | the benefits of GHC's recompilation checker.
|
| 608 | 608 | |
| 609 | 609 | The pre-processor is run just before the Haskell compiler proper
|
| ... | ... | @@ -622,6 +622,10 @@ Options affecting a Haskell pre-processor |
| 622 | 622 | :ghc-flag:`-optF ⟨option⟩` option. These are fed to ⟨cmd⟩ on the command
|
| 623 | 623 | line after the three standard input and output arguments.
|
| 624 | 624 | |
| 625 | + GHC sets the environment variable `GHC_VERSION` to the current GHC version when invoking
|
|
| 626 | + a pre-processor. The pre-processor can use this to emit
|
|
| 627 | + backwards compatible code.
|
|
| 628 | + |
|
| 625 | 629 | An example of a pre-processor is to convert your source files to the
|
| 626 | 630 | input encoding that GHC expects, i.e. create a script ``convert.sh``
|
| 627 | 631 | containing the lines:
|