NamedDefaults and relaxed defaults?

Benjamin Redelings benjamin.redelings at gmail.com
Wed Jul 26 10:00:29 UTC 2023


Hi,

If I understand correctly, the traditional defaulting rules prevent 
defaulting variables with constraints like (Num a, Convertible a 
Double), but the NamedDefaults proposal would allow defaulting a ~ 
Double in this case due to the relaxed defaulting rules in section 2.5 
of the proposal:

https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0409-exportable-named-default.rst#id2

1. Is there any plan to start implementing NamedDefaults?  I saw the 
comment from Simon P-J that it would not be fun to implement because it 
might require orphan default declarations... so perhaps there's no plan 
to implement this?

2. Would it be worth adding a separate LANGUAGE option that just 
implements the relaxed defaulting rules in section 2.5? Specifically (a) 
allowing variables with multiparameter constraints and (b) allowing 
variables with constraints that are not in the Prelude.

3. Am I correct in assuming that the relaxed defaulting rules require 
NamedDefaults to be enabled in the importing module, and not just in the 
imported model?

-BenRI


More information about the ghc-devs mailing list