Skip to content
  • Ryan Scott's avatar
    Allow PartialTypeSignatures in standalone deriving contexts · affdea82
    Ryan Scott authored
    Summary:
    At its core, this patch is a simple tweak that allows a user
    to write:
    
    ```lang=haskell
    deriving instance _ => Eq (Foo a)
    ```
    
    Which is functionally equivalent to:
    
    ```lang=haskell
    data Foo a = ...
      deriving Eq
    ```
    
    But with the added flexibility that `StandaloneDeriving` gives you
    (namely, the ability to use it anywhere, not just in the same module
    that `Foo` was declared in). This fixes #13324, and should hopefully
    address a use case brought up in #10607.
    
    Currently, only the use of a single, extra-constraints wildcard is
    permitted in a standalone deriving declaration. Any other wildcard
    is rejected, so things like
    `deriving instance (Eq a, _) => Eq (Foo a)` are currently forbidden.
    
    There are quite a few knock-on changes brought on by this change:
    
    * The `HsSyn` type used to represent standalone-derived instances
      was previously `LHsSigType`, which isn't sufficient to hold
      wildcard types. This needed to be changed to `LHsSigWcType...
    affdea82