Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
GHC
GHC
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 4,390
    • Issues 4,390
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
    • Iterations
  • Merge Requests 374
    • Merge Requests 374
  • Requirements
    • Requirements
    • List
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Operations
    • Operations
    • Incidents
    • Environments
  • Analytics
    • Analytics
    • CI / CD
    • Code Review
    • Insights
    • Issue
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #3674

Closed
Open
Opened Nov 18, 2009 by dorchard@trac-dorchard

Recognise language pragmas generated by custom pre-processors (run with -F)

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).

Trac metadata
Trac field Value
Version
Type FeatureRequest
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None
Reference: ghc/ghc#3674