You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Defining a Newtype or Generic instance for a data type effectively means that anyone who can see the type can also see its constructor(s). Therefore, I don't think there is ever a good reason to export a data type without its constructors if that data type has Newtype or Generic instances. Additionally, I suspect that when exported types have these instances without exported constructors, it's usually accidental, and the author doesn't realise that they are effectively making the constructors public by providing these instances.
I'd suggest having the compiler emit warnings for data types where all of the following are true:
The data type is exported
Not all of the constructors are exported
The type has a derived Newtype or Generic instance
thomashoneyman, klntsky, MonoidMusician and matthew-hilty