[GHC] #14685: Pragma to reset language extensions in module header

GHC ghc-devs at haskell.org
Fri Jan 19 04:49:33 UTC 2018


#14685: Pragma to reset language extensions in module header
-------------------------------------+-------------------------------------
           Reporter:  mgsloan        |             Owner:  (none)
               Type:  feature        |            Status:  new
  request                            |
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  8.2.2
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 In https://github.com/commercialhaskell/stack/issues/3789 , there is an
 issue where if OverloadableStrings is enabled in default extensions, the
 Paths_ module generated by cabal no longer compiles. I've opened a fix
 here - https://github.com/haskell/cabal/pull/5054 .  However, this just
 disables specific extensions known to be problematic.  It would be better
 to have a pragma that says "Please reset the extensions used for this
 module".

 I propose

 {{{
 {-# LANGUAGE_RESET Haskell2010 #-}
 }}}


 and

 {{{
 {-# LANGUAGE_RESET Haskell98 #-}
 }}}

 This would also provide for quite a nice workaround for the most common
 source of trouble when loading multiple packages at once into ghci -
 default-extensions causing some code to no longer compile.  See
 https://ghc.haskell.org/trac/ghc/ticket/10827 for more about this.  With
 `LANGUAGE_RESET`, we could write packages that gracefully load along with
 other packages that specify default-extensions.

 Of course, this is open to name bikeshedding.  `{-# SET_LANGUAGE Haskell98
 #-}`? Or perhaps just straight up `{-# HASKELL_98 #-}`.

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14685>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list