Skip to content

Do the warnings 'No explicit implementation for ToValue' cause errors elsewhere #202

Open
@EdmundsEcho

Description

@EdmundsEcho

When deriving ToValue instances I get a warning No explicit implementation for 'toValue'. For instance,

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

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.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions