Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
EdmundsEcho opened this issue Sep 3, 2018 · 0 comments

Comments

@EdmundsEcho
Copy link

EdmundsEcho commented Sep 3, 2018

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

@EdmundsEcho EdmundsEcho changed the title Pointers for how to implement ToValue Do the warnings 'No explicit implementation for ToValue` Sep 3, 2018
@EdmundsEcho EdmundsEcho changed the title Do the warnings 'No explicit implementation for ToValue` Do the warnings 'No explicit implementation for ToValue' cause errors elsewhere Sep 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant