Skip to content

Commit 4b31a2c

Browse files
Victor NawothnigVictor Nawothnig
Victor Nawothnig
authored and
Victor Nawothnig
committed
Fix overlapping errors
1 parent 3a0601a commit 4b31a2c

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

src/GraphQL/Internal/API/Enum.hs

+3-11
Original file line numberDiff line numberDiff line change
@@ -86,24 +86,16 @@ instance forall conName p b. (KnownSymbol conName) => GenericEnumValues (C1 ('Me
8686

8787
-- TODO(tom): better type errors using `n`. Also type errors for other
8888
-- invalid constructors.
89-
instance forall conName p b sa sb.
90-
( TypeError ('Text "Constructor not unary: " ':<>: 'Text conName)
89+
instance forall conName f s sa sb.
90+
( TypeError ('Text "Constructor not nullary: " ':<>: 'Text conName)
9191
, KnownSymbol conName
9292
) => GenericEnumValues (C1 ('MetaCons conName p b) (S1 sa sb)) where
9393
genericEnumValues = nonUnaryConstructorError
9494
genericEnumFromValue = nonUnaryConstructorError
9595
genericEnumToValue = nonUnaryConstructorError
9696

97-
instance forall conName p b sa sb f.
98-
( TypeError ('Text "Constructor not unary: " ':<>: 'Text conName)
99-
, KnownSymbol conName
100-
) => GenericEnumValues (C1 ('MetaCons conName p b) (S1 sa sb) :+: f) where
101-
genericEnumValues = nonUnaryConstructorError
102-
genericEnumFromValue = nonUnaryConstructorError
103-
genericEnumToValue = nonUnaryConstructorError
104-
10597
nonUnaryConstructorError :: a
106-
nonUnaryConstructorError = panic "Tried to construct enum with non-unary constructor. Should get a compile-time error instead of this."
98+
nonUnaryConstructorError = panic "Tried to construct enum with non-nullary constructor. Should get a compile-time error instead of this."
10799

108100
-- | For each enum type we need 1) a list of all possible values 2) a
109101
-- way to serialise and 3) deserialise.

0 commit comments

Comments
 (0)