Skip to content

Pragma to reset language extensions in module header

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 #10827 (closed) 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 #-}.

Trac metadata
Trac field Value
Version 8.2.2
Type FeatureRequest
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information