
+1, this is a great idea
On Sat, Aug 31, 2019 at 2:36 AM David Feuer
It sounds like we can probably agree not to include the instance for now. But I don't want to just go with my gut feeling, so here's a concrete reason:
Generically isn't *just* a DerivingVia target: it's also a perfectly reasonable newtype in its own right. Consider something like CoercibleUtils.Newtype [*]. If you try to work `under Generically` with your instance, then the type checker won't let you. That's rather sad, I think, because it seems like a perfectly sensible thing to do.
[*] https://github.com/sjakobi/coercible-utils/blob/072c60837059aaaac47628a1822c...
On Fri, Aug 30, 2019, 8:26 PM Alexis King
wrote: On Aug 30, 2019, at 17:26, Alexis King
wrote: If you want to leave that instance out, that’s fine with me; I highly doubt anyone would miss it. As I said before, it’s totally useless.
Actually, I take this back. It’s not totally useless, just unlikely to be useful (and ultimately inessential). It’s theoretically useful if you have some function like
foo :: (Show a, Generic a) => a -> Foo
and want to use the generic version of the `Show` instance, but for some reason don’t want to actually define that instance on your type. You can write `foo (Generically x)`, and it will work out. That wouldn’t work if `Generic (Generically a)` were the derived instance.
On the other hand, you could always get the same behavior in a more flexible way by just defining a separate newtype and deriving the relevant instances as desired, like this:
newtype GenericallyShowable a = GenericallyShowable a deriving newtype (Generic) deriving (Show) via Generically a
So the instance isn’t necessary by any means, nor does it seem particularly likely to be useful in practice, but it doesn’t seem impossible that it ever could be. My vote is to keep it; I don’t see the harm.
_______________________________________________ Libraries mailing list Libraries@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries