Ticket #3674 (closed bug: fixed)
Recognise language pragmas generated by custom pre-processors (run with -F)
| Reported by: | dorchard | Owned by: | simonmar |
|---|---|---|---|
| Priority: | normal | Milestone: | 7.0.1 |
| Component: | Driver | Version: | |
| Keywords: | customer pre-processor | Cc: | |
| Operating System: | Unknown/Multiple | Architecture: | Unknown/Multiple |
| Type of failure: | GHC rejects valid program | Difficulty: | Moderate (less than a day) |
| Test Case: | Blocked By: | ||
| Blocking: | Related Tickets: |
Description
A custom pre-processor might desugar terms into terms of a particular language extension, requiring a new language pragma. Currently, any language pragmas generated by a pre-processor will be ignored once the pre-processed file is picked up by GHC again.
As a contrived example, consider foo.hs:
{-# OPTIONS -F -pgmF ./preprocess.sh #-}
data Foo a where MkFoo :: Foo a
where preprocess.sh:
#!/bin/sh
( echo "{-# LANGUAGE GADTs #-}"; cat $2; ) > $3
Currently we get this behaviour:
bash-3.2$ ghc foo.hs
/tmp/ghc7191_0/ghc7191_0.hspp:4:0:
Illegal generalised algebraic data declaration for `Foo'
(Use -XGADTs to allow GADTs)
In the data type declaration for `Foo'
bash-3.2$ ghc foo.hs -E
bash-3.2$ cat foo.hspp
{-# LANGUAGE GADTs #-}
{-# OPTIONS -F -pgmF ./preprocess.sh #-}
data Foo a where MkFoo :: Foo abash-3.2$
It would be nice if GHC noticed the new pragmas, particularly language pragmas, although perhaps not all pragmas should be picked up (maybe not new OPTION pragmas).
Change History
Note: See
TracTickets for help on using
tickets.
