darcs

Patch 1122 Replace "aggregator" classes with constraint synonyms

Title Replace "aggregator" classes with constraint synonyms
Superseder Nosy List ganesh, owst
Related Issues
Status obsoleted Assigned To
Milestone

Created on 2014-02-10.22:48:46 by ganesh, last changed 2015-09-20.09:56:32 by ganesh.

Files
File name Status Uploaded Type Edit Remove
patch-preview.txt ganesh, 2014-02-10.22:48:46 text/x-darcs-patch
replace-_aggregator_-classes-with-constraint-synonyms.dpatch ganesh, 2014-02-10.22:48:46 application/x-darcs-patch
unnamed ganesh, 2014-02-10.22:48:46
See mailing list archives for discussion on individual patches.
Messages
msg17192 (view) Author: ganesh Date: 2014-02-10.22:48:46
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
msg18744 (view) Author: ganesh Date: 2015-09-20.09:56:32
On reflection I think it's best not to do this. If anyone would like to 
revive it just re-open this ticket and we can discuss more.
History
Date User Action Args
2014-02-10 22:48:46ganeshcreate
2014-02-10 22:48:59ganeshsetstatus: needs-screening -> in-discussion
nosy: + owst
2015-09-20 09:56:32ganeshsetstatus: in-discussion -> obsoleted
messages: + msg18744