Skip to content

Commit f7ed7bb

Browse files
Victor NawothnigVictor Nawothnig
authored andcommitted
Properly recurse into :*:
Resolves #173
1 parent f06c7af commit f7ed7bb

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

src/GraphQL/Internal/Value/FromValue.hs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -100,15 +100,12 @@ instance forall dataName consName records s l p.
100100
)) where
101101
genericFromValue o = M1 . M1 <$> genericFromValue @records o
102102

103-
instance forall wrappedType fieldName rest u s l.
104-
( KnownSymbol fieldName
105-
, FromValue wrappedType
106-
, GenericFromValue rest
107-
) => GenericFromValue (S1 ('MetaSel ('Just fieldName) u s l) (Rec0 wrappedType) :*: rest) where
108-
genericFromValue object = do
109-
l <- getValue @wrappedType @fieldName object
110-
r <- genericFromValue @rest object
111-
pure (l :*: r)
103+
104+
instance forall l r.
105+
( GenericFromValue l
106+
, GenericFromValue r
107+
) => GenericFromValue (l :*: r) where
108+
genericFromValue object = liftA2 (:*:) (genericFromValue @l object) (genericFromValue @r object)
112109

113110
-- | Look up a single record field element in the Object.
114111
getValue :: forall wrappedType fieldName u s l p. (FromValue wrappedType, KnownSymbol fieldName)

0 commit comments

Comments
 (0)