This is for discussion only at present.
With the switch to GHC 7.4, we can switch the "aggregator" Patch classes
to use constraint synonyms - kind of like replacing a newtype with a type
synonym.
I've done this in the attached patch, though I'm not sure it's actually
a good thing. We lose some orphan instances, but gain some
UndecidableInstances pragmas (I don't quite understand why they are
actually necessary, but GHC insisted).
In particular I think we lose the documentation benefits of the
aggregator classes as separate entities. For example,
instance PrimPatch prim => Patchy (Patch prim)
instance PrimPatch prim => RepoPatch (Patch prim)
tells us clearly that a (V1) patch just depends on the PrimPatch class
for its contained primitives, whereas some of the messier instances like
instance (IsHunk p, PatchListFormat p, Patchy p) => Patchy (FL p)
instance (IsHunk p, PatchListFormat p, Patchy p) => Patchy (RL p)
tell us that things aren't quiet as clean as we might like.
On the other hand making this change may make other changes nicer - for
example I'm currently looking at using a type function to allow the
inverse of a patch type p to be a different type.
Copy on darcs hub at
http://hub.darcs.net/ganesh/darcs-screened-constraint-synonyms/patch/20140210213341-81bb2
1 patch for repository darcs-unstable@darcs.net:screened:
Mon Feb 10 21:33:41 GMT 2014 Ganesh Sittampalam <ganesh@earth.li>
* Replace "aggregator" classes with constraint synonyms
This applies to PrimPatch, Patchy and RepoPatch
Attachments
|