Skip to content
  • John Ericson's avatar
    Skip type family defaults with hs-boot and hsig files · cf4de90e
    John Ericson authored
    Works around #17190, possible resolution for #17224
    
    Instances in signatures currently unconditionally opt into associated
    family defaults if no explicit instance is given. This is bad for two
    reasons:
    
      1. It constrains possible instantiations to use the default, rather
      than possibly define the associated family differently.
    
      2. It breaks compilation as type families are unsupported in
      signatures.
    
    This PR simply turns off the filling in of defaults in those cases.
    Additionally, it squelches a missing definition warning for hs-boot too
    that was only squelched for hsig before.
    
    The downsides are:
    
      1. There is no way to opt into the default, other than coppying its
      definition.
    
      2. If we fixed type classes in signatures, and wanted instances to
      have to explicitly *out of* rather than into the default, that would
      now be a breaking change.
    
    Neither opt-in or opt-out is very appealing. Perhaps the right answer is
    "just use deriving via"! Default methods are once again being more
    combersome and requiring more syntax (c.f. default signatures), and yet
    are still less powerful.
    
    The only part of this patch I am sure is a good iea is harmonizing the
    warning squelching between hs-boot or hsig. Maybe they should have the
    warning (opt out of default) maybe they shouldn't (opt in to default),
    but surely it should be the same for both.
    cf4de90e