Skip to content
  • John Ericson's avatar
    Skip type family defaults with hs-boot and hsig files · 59d7c9f4
    John Ericson authored and Marge Bot's avatar Marge Bot committed
    Works around #17190, possible resolution for #17224. New design is is
    according to accepted [GHC Propoal 320].
    
    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 copying 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.
    
    The change that is most unambiguously goood 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.
    
    Add hs-boot version of a backpack test regarding class-specified
    defaults in instances that appear in an hs-boot file.
    
    The metrics increase is very slight and makes no sense --- at least no
    one has figured anything out after this languishing for a while, so I'm
    just going to accept it.
    
    Metric Increase:
      T10421a
    
    [GHC proposal 320]: https://github.com/ghc-proposals/ghc-proposals/pull/320
    59d7c9f4