-
Notifications
You must be signed in to change notification settings - Fork 33
Open
Description
I can't seem to construct a multi-field argument without several errors: Here's what I have so far:
type QuoteGQL = GQLAPI.Object "QuoteGQL" '[]
'[ GQLAPI.Argument "symbol" Text :> GQLAPI.Field "globalQuote" QuoteR ]
type QuoteR = GQLAPI.Object "QuoteR" '[]
'[ GQLAPI.Field "symbol" Text
, GQLAPI.Field "open" Text
, GQLAPI.Field "high" Text
, GQLAPI.Field "low" Text
, GQLAPI.Field "price" Text
, GQLAPI.Field "volume" Text
, GQLAPI.Field "latestTradingDay" Text
, GQLAPI.Field "previousClose" Text
, GQLAPI.Field "change" Text
, GQLAPI.Field "changePercent" Text
]
data QuoteRecord = QuoteRecord { symbol :: Text
, open :: Text
, high :: Text
, low :: Text
, price :: Text
, volume :: Text
, latestTradingDay :: Text
, previousClose :: Text
, change :: Text
, changePercent :: Text
} deriving (Eq, Show, Generic)
makeQuoteR :: QuoteRecord -> Maybe QuoteR
makeQuoteR qr = GQLV.objectFromList
[ ( "symbol", TV.toValue $ symbol qr)
, ( "open", TV.toValue $ open qr)
, ( "high", TV.toValue $ high qr)
, ( "low", TV.toValue $ low qr)
, ( "price", TV.toValue $ price qr)
, ( "volume", TV.toValue $ volume qr)
, ( "latestTradingDay", TV.toValue $ latestTradingDay qr)
, ( "previousClose", TV.toValue $ previousClose qr)
, ( "change", TV.toValue $ change qr)
, ( "changePercent", TV.toValue $ changePercent qr)
]
makeQuoteGQL is failing to typeCheck with
Expected type: Maybe QuoteR
Actual type: Maybe (GQLV.Object' GQLV.ConstScalar)
How on Earth can I construct a QuoteR - I need to use the record type as an intermediary because GQLAPI.Object does not implement FromJSON
what am I missing for these more complex types?
Metadata
Metadata
Assignees
Labels
No labels