Skip to content

Commit

Permalink
Derive a few GqlUnion and UnionReturned instances in GraphQL/Client/U…
Browse files Browse the repository at this point in the history
…nion.purs
  • Loading branch information
bakhtiyarneyman committed Apr 30, 2024
1 parent e459880 commit 01854dc
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/GraphQL/Client/Union.purs
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@ import Type.Proxy (Proxy(..))

newtype GqlUnion r = GqlUnion (Record r)

derive instance newtypeGqlUnion :: Newtype (GqlUnion r) _
derive newtype instance Eq (Record r) => Eq (GqlUnion r)
derive newtype instance Ord (Record r) => Ord (GqlUnion r)
derive instance Newtype (GqlUnion r) _

newtype UnionReturned r = UnionReturned (Variant r)

derive instance newtypeGqlUnionReturned :: Newtype (UnionReturned r) _
derive instance Newtype (UnionReturned r) _

instance (RL.RowToList r rl, DecodeUnion rl r) => DecodeJson (UnionReturned r) where
decodeJson = decodeJsonUnionWith (decodeUnion :: _ -> _ -> Proxy rl -> _)
Expand Down Expand Up @@ -104,4 +106,3 @@ failedAtTypename ty _ _ = Left $ AtKey __typename $ UnexpectedValue $ fromString

__typename :: String
__typename = "__typename"

0 comments on commit 01854dc

Please sign in to comment.