@@ -36,7 +36,7 @@ import Data.String.CodeUnits (charAt)
3636import Data.Symbol (class IsSymbol , reflectSymbol )
3737import GraphQL.Client.Alias (Alias )
3838import GraphQL.Client.Alias.Dynamic (Spread )
39- import GraphQL.Client.Args (AndArg , Args , NotNull , OrArg )
39+ import GraphQL.Client.Args (AndArg , AndArgs , Args , NotNull , OrArg )
4040import GraphQL.Client.AsGql (AsGql )
4141import GraphQL.Client.Directive (ApplyDirective (..))
4242import GraphQL.Client.ErrorBoundary (ErrorBoundary )
@@ -126,6 +126,15 @@ else instance getVarAndArg ::
126126 ) =>
127127 GetVar (AndArg l r ) { | var } where
128128 getVar _ = Proxy
129+ else instance getVarAndArgs ::
130+ ( GetVar l { | varL }
131+ , GetVar r { | varR }
132+ , Row.Union varR varL trash
133+ , Row.Union varL varR trash -- keep both union directions to make sure value type is the same
134+ , Row.Nub trash var
135+ ) =>
136+ GetVar (AndArgs l r ) { | var } where
137+ getVar _ = Proxy
129138else instance getVarOrArg ::
130139 ( GetVar l { | varL }
131140 , GetVar r { | varR }
@@ -229,19 +238,19 @@ else instance varsTypeCheckedWithoutVars ::
229238
230239else instance varsTypeCheckedIdentity ::
231240 GetVar query { } =>
232- VarsTypeChecked schema (Identity query ) where
241+ VarsTypeChecked schema (Identity query ) where
233242 getVarsJson _ _ = jsonEmptyObject
234243 getVarsTypeNames _ _ = " "
235244
236245else instance varsTypeCheckedErrorBoundary ::
237246 GetVar query { } =>
238247 VarsTypeChecked schema (ErrorBoundary query ) where
239248 getVarsJson _ _ = jsonEmptyObject
240- getVarsTypeNames _ _ = " "
249+ getVarsTypeNames _ _ = " "
241250
242251else instance varsTypeCheckedUnion ::
243252 GetVar { | query } { } =>
244- VarsTypeChecked schema (GqlUnion query ) where
253+ VarsTypeChecked schema (GqlUnion query ) where
245254 getVarsJson _ _ = jsonEmptyObject
246255 getVarsTypeNames _ _ = " "
247256
0 commit comments