Fix #10857: ghci ignores -XMonomorphismRestriction and -XNoExtendedDefaultRules command line flags

Authored by RolandSenn on Dec 12 2018, 2:25 PM.



In GHCi instead of just setting unconditionally the extension ExtendedDefaultRules ON and the MonomorphismRestriction OFF, we first check, whether these extensions were not set on the command line.

Test Plan

make test TEST="T10857a T10857b"

RolandSenn created this revision.Dec 12 2018, 2:25 PM

Looks good, thanks. I suggest a minor refactoring


Presumably "The extensions..."

There is nothing in the comments on DynFlags.extensions to say that they are command line flags. Do you mean specifically the command line, or command line + LANGUAGE pragmas in the source file, + .ghci file + ??? Could you update the comments on DynFlags.extensions to say?


Why not put all this logic into a new function, in DynFlags. I think something like

  :: LangExt.Extension
  -> (DynFlags -> LangExt.Extension -> DynFlags)
  -> DynFlags -> DynFlags

Invoked roughly as

dflags' = unlessExplicitlySpecified  ExtendedDefaultRules       xopt_set$
               unlessExplicitlySpecified MonomorphismRestriction xopt_unset $

That might repeat the stripOnOrOff, but so be it. Or you could have a specialised version of elem inside unlessExplicitlySpecified.

-> (
RolandSenn marked 2 inline comments as done.Dec 13 2018, 10:47 AM

Thanks for the code review!

RolandSenn added a comment.EditedDec 24 2018, 6:39 AM

Moved to Gitlab Merge Request !35

RolandSenn abandoned this revision.Dec 24 2018, 7:25 AM
This comment was removed by RolandSenn.