Skip to content
Snippets Groups Projects
Commit fe80eaf6 authored by Phil Hazelden's avatar Phil Hazelden
Browse files

Don't suggest `DeriveAnyClass` when instance can't be derived.

According to #19692, this isn't a very useful suggestion.

Various possibilities:

    class C a where
      c :: a -> Int
    data G = G1 deriving C

used to give this suggestion, and the suggestion would have failed. Now
doesn't give the suggestion.

    class C a where
      c :: a -> Int
      c _ = 0
    data G = G1 deriving C

used to give this suggestion, but the suggestion would have succeded.
Now doesn't give the suggestion. I believe this is also the case if `C`
has no methods at all. Regression.

    class A
    deriving instance A

Used to give this suggestion, still does. The suggestion succeeds. I
don't yet know why it still gives this suggestion.

    class C1 c
    class C2 c where
      dict :: Dict a
    deriving instance C2 (C1 Int)

Used to give this suggestion, still does. The suggestion fails, but
would succeed if `dict` had a default (or didn't exist). This comes from
`DerivErrOnlyAnyClassDeriveable`.

    data A = A Int deriving anyclass Eq

Used to give this suggestion, still does. The suggestion fails. But
since the user explicitly mentioned `anyclass`, it still seems like a
reasonable suggestion.
parent 273ff0c7
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment