The existing code has overlapping instances, namely for:
(l :+: r) and (C1 (...) :+: r)
The second instance is unnecessary, since the instance for C1 (...) (S1 sa sb) will produce a type error already.
Some code that triggers the overlapping instances error:
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE TypeApplications #-}
import GraphQL.Internal.API.Enum (GraphQLEnum(..))
import GHC.Generics (from, to, Generic)
data Magic = Left Int | Right deriving (Eq, Show, Generic)
instance GraphQLEnum Magic
main = main
f = enumValues @Magic
Also an unary constructor is one that takes one argument, so I took the liberty to rename the diagnostics to nullary constructors.
A test case would be a bit more difficult because it still fails compilation.
This fix is similar to: https://github.com/haskell-graphql/graphql-api/pull/178
The existing code has overlapping instances, namely for:
(l :+: r)
and(C1 (...) :+: r)
The second instance is unnecessary, since the instance for
C1 (...) (S1 sa sb)
will produce a type error already.Some code that triggers the overlapping instances error:
Also an unary constructor is one that takes one argument, so I took the liberty to rename the diagnostics to nullary constructors.
A test case would be a bit more difficult because it still fails compilation.