Opened 15 months ago

Closed 2 months ago

#14551 closed bug (duplicate)

GHCi ignores -XMonomorphismRestriction and -XNoExtendedDefaultRules

Reported by: dfeuer Owned by:
Priority: normal Milestone: 8.8.1
Component: GHCi Version: 8.2.1
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Other Test Case:
Blocked By: Blocking:
Related Tickets: #10857 Differential Rev(s):
Wiki Page:

Description (last modified by dfeuer)

Because of the way the GHCi defaults are applied, specifying -XMonomorphismRestriction or -XNoExtendedDefaultRules on the GHCi command line doesn't actually make those take effect at the interactive prompt. They get reset to their interactive defaults afterwards. This is rather surprising, and I think it should be fixed.

dfeuer@squirrel> ghci -XMonomorphismRestriction
Prelude> x = 3
Prelude> :t x
x :: Num t => t   -- What? I said I wanted the restriction!
Prelude> :set -XMonomorphismRestriction
Prelude> y = 3
Prelude> :t y
y :: Integer

One option is to dig through the parsed flags after setting the defaults to try to find these, but that sounds unpleasant. We're slowly accumulating hacks in this area, and it would be nice to find a better approach.

Change History (3)

comment:1 Changed 15 months ago by dfeuer

Description: modified (diff)

comment:2 Changed 8 months ago by bgamari

Milestone: 8.6.18.8.1

These won't be addressed in GHC 8.6.

comment:3 Changed 2 months ago by RolandSenn

Resolution: duplicate
Status: newclosed

This is exactly the same as #10857

Note: See TracTickets for help on using tickets.