[Haskell-cafe] Re: could we get a Data instance for
lennart at augustsson.net
Sat Jan 23 19:52:30 EST 2010
> The only safe rule is: if you don't control the class, C, or you don't
> control the type constructor, T, don't make instance C T.
I agree in principle, but in the real world you can't live by this rule.
Example, I want to use Uniplate to traverse the tree built by haskell-src-exts,
Using Data.Data is too slow, so I need to make my own instances.
HSE provides like 50 types that need instances, and it has to be
exactly those types.
Also, Uniplate requires instances of a particular class it has.
I don't own either of these packages. Including the HSE instances in
Uniplate would just be plain idiotic.
Including the Uniplate instances with HSE would make some sense, but
would make HSE artificially depend on Uniplate for those who don't
want the instances.
So, what's left is to make orphan instances (that I own). It's not
ideal, but I don't see any alternative to it.
More information about the Haskell-Cafe