Open EdmundsEcho opened 6 years ago
When deriving ToValue instances I get a warning No explicit implementation for 'toValue'. For instance,
ToValue
No explicit implementation for 'toValue'
data MixInput = MixInput { nameKey :: Maybe Text , mixItems :: ![MixItemInput] -- an instance of ToValue } deriving (Show, Generic) instance FromValue MixInput instance ToValue MixInput <<< Warning -> generates an error when evaluated instance HasAnnotatedInputType MixInput instance Defaultable MixInput
In my experience, the App compiles, but generates a runtime error when the toValue instance is evaluated.
toValue
So for instance, the following compiles And avoids any runtime errors.
instance ToValue MixInput where toValue MixInput {..} = toValue $ fromJust $ objectFromList [ ("nameKey", toValue (toValue @Text <$> nameKey)) , ("mixItems", toValue (toValue @MixItemInput <$> mixItems)) ] instance ToValue MixItemInput where etc..
Question Is this behavior/feedback by design?
- E
When deriving
ToValue
instances I get a warningNo explicit implementation for 'toValue'
. For instance,Update
In my experience, the App compiles, but generates a runtime error when the
toValue
instance is evaluated.So for instance, the following compiles And avoids any runtime errors.
Question Is this behavior/feedback by design?
- E