Hi, I wonder whether there is some preferred, idiomatic way to deal with things like
data A = MkA
{ a1 :: Text
, a2 :: B
}
deriving stock Generic
deriving anyclass FromForm
data B = MkB
{ b1 :: Text
, ... }
deriving stock Generic
deriving anyclass FromForm
fails with "No instance FromHttpApiData B arising from..." because of this instance her:
instance {-# OVERLAPPABLE #-} (Selector s, FromHttpApiData c) => GFromForm t (M1 S s (K1 i c)) where
gFromForm _ opts form = M1 . K1 <$> parseUnique key form
where
key = Text.pack $ fieldLabelModifier opts $ selName (Proxy3 :: Proxy3 s g p)
This is quite unfortunate because I would like to somehow indicate that this should be derived recursively somehow; perhaps we can indicate this somehow by using a newtype wrapper in A's recursive field and then deriving everything newtype for it and then add an {-# OVERLAPPING #-} instance to the generic deriving? Though that would be quite the mess. I wonder what is a good way to do this.
Hi, I wonder whether there is some preferred, idiomatic way to deal with things like
fails with
"No instance FromHttpApiData B arising from..."
because of this instance her:This is quite unfortunate because I would like to somehow indicate that this should be derived recursively somehow; perhaps we can indicate this somehow by using a newtype wrapper in
A
's recursive field and then deriving everything newtype for it and then add an{-# OVERLAPPING #-}
instance to the generic deriving? Though that would be quite the mess. I wonder what is a good way to do this.Thanks in advance.