Skip to content

Treat -X flags consistently in GHCi

Currently GHCi treats -X language extension flags as follows: the -X extension applies to both code typed to the GHCi prompt, and to modules loaded by GHCi. This happens whether the -X flag is given on the command line when invoking GHCi, or in a :set command.

But there is one exception! The -XExtendedDefaultRules flag applies only to modules loaded by GHCi. For code typed at the GHCi prompt, the -XExtendedDefaultRules flag is always on, and cannot be switched off. This is (a) inconsistent and (b) awkward if you want to switch it off.

Talking to Simon, the Right Thing seems to be to this:

  • GHCi should maintain two sets of flag settings: one for the GHCi prompt, and one for loaded modules
  • The two flat-sets are initialised identical, except that -XExtendedDefaultRules is set for GHCi.
  • Command-line flags are applied to both flag-sets.
  • The :set command affects both flag-sets
  • Add a new :set-local command to affect the GHCi prompt flag-set only.
  • (It's probably not worth a command that affects only the loaded modules.)

It's not clear how urgent this is. Add yourself to cc list if you care, and add a comment.

Simon

Trac metadata
Trac field Value
Version 6.8.3
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