Data and Typeable instances

Lennart Augustsson lennart at
Sun Apr 19 18:43:43 EDT 2009

It's great if the instances preserve the abstraction.
As I said, I'm not a fan of Data, but it makes certain things very convenient.

On Sun, Apr 19, 2009 at 11:41 PM, Duncan Coutts
<duncan.coutts at> wrote:
> On Sun, 2009-04-19 at 13:58 -0700, Ashley Yakeley wrote:
>> I will not expose any private structure of types via instances of the
>> Data class. I can't see what benefits SYB brings that it outweighs such
>> loss of abstraction. And if someone else wants to shoot themselves in
>> the foot by using standalone deriving, that's their problem.
> It's ok, abstraction is preserved by standalone deriving. You can only
> derive for types where you can import the constructors.
>> However, this might not be an issue, as I believe all the constructors
>> of all or almost all types in time are public. If it is possible for a
>> user of time to hand-write instances of Data using only what time
>> exposes, then it is safe to include those instances in the package.
> Right, that seems like a sensible solution, that is to include Data
> instances that preserve the abstraction. As you say, that can be tested
> by initially writing the instances outside the package so that you can
> be sure it's only using the public interface.
> Duncan
> _______________________________________________
> Libraries mailing list
> Libraries at

More information about the Libraries mailing list