darcs

Patch 489 abstract Patch over prim type (and 1 more)

Title abstract Patch over prim type (and 1 more)
Superseder Nosy List ganesh
Related Issues
Status accepted Assigned To
Milestone

Created on 2010-11-23.23:37:27 by ganesh, last changed 2011-05-10.17:36:44 by darcswatch. Tracked on DarcsWatch.

Files
File name Status Uploaded Type Edit Remove
abstract-patch-over-prim-type.dpatch ganesh, 2010-11-23.23:37:27 text/x-darcs-patch
unnamed ganesh, 2010-11-23.23:37:27
See mailing list archives for discussion on individual patches.
Messages
msg13251 (view) Author: ganesh Date: 2010-11-23.23:37:27
And finally we can actually parametrise V1/V2 patches over the
underlying Prim.

2 patches for repository darcs-unstable@darcs.net:screened:

Tue Nov 23 07:42:50 GMT 2010  Ganesh Sittampalam <ganesh@earth.li>
  * abstract Patch over prim type

Tue Nov 23 07:50:27 GMT 2010  Ganesh Sittampalam <ganesh@earth.li>
  * abstract RealPatch over Prim
Attachments
msg13254 (view) Author: darcswatch Date: 2010-11-24.00:01:08
This patch bundle (with 2 patches) was just applied to the repository http://darcs.net/screened.
This message was brought to you by DarcsWatch
http://darcswatch.nomeata.de/repo_http:__darcs.net_screened.html#bundle-f9b9f18599e567e4f8a1fc055ff45eb2aecfefc8
msg13620 (view) Author: gh Date: 2011-02-02.00:49:16
Depends on patch487
msg13632 (view) Author: gh Date: 2011-02-05.18:52:13
First patch takes care of darcs-1 patch semantics, second one of darcs-2.


      * abstract Patch over prim type


Replace Patch by Patch Prim:
        M ./src/Darcs/Commands/Convert.lhs -4 +5
        M ./src/Darcs/Commands/Get.lhs -2 +3

It happens here:
        M ./src/Darcs/Patch/V1.hs -2 +3

hunk ./src/Darcs/Patch/V1.hs 5
+import Darcs.Patch.Prim ( PrimPatch )
hunk ./src/Darcs/Patch/V1.hs 15
-instance Patchy Patch
-instance RepoPatch Patch
+instance PrimPatch prim => Patchy (Patch prim)
+instance PrimPatch prim => RepoPatch (Patch prim)


Then it's a matter of adapting types:
        M ./src/Darcs/Patch/V1/Apply.hs -2 +2
        M ./src/Darcs/Patch/V1/Commute.lhs -41 +42
        M ./src/Darcs/Patch/V1/Core.lhs -20 +19
        M ./src/Darcs/Patch/V1/Read.hs -2 +3
        M ./src/Darcs/Patch/V1/Show.lhs -6 +6
        M ./src/Darcs/Patch/V1/Viewing.hs -2 +3

The changes are bigger in Commute, where more fine-grained class
requirements is done on some functions.

Replace Patch by Patch Prim:
        M ./src/Darcs/Repository.hs -2 +3
        M ./src/Darcs/Repository/Internal.hs -1 +2
        M ./src/Darcs/Test/Patch.hs -1 +3

Same + use pragma "TypeSynonymInstances" to be able to write "type Patch
= V1.Patch Prim":
        M ./src/Darcs/Test/Patch/Test.hs -11 +15


=============================

     * abstract RealPatch over Prim


RealPatch -> RealPatch prim:
        M ./src/Darcs/Commands/Convert.lhs -4 +4


An extra haddock comment:
        M ./src/Darcs/Patch/V1/Core.lhs +4

Here is where it happens:
        M ./src/Darcs/Patch/V2.hs -1 +2

-instance RepoPatch RealPatch
+instance PrimPatch prim => RepoPatch (RealPatch prim)

Many lines changed by just consequence of RepoPatch parametrization +
comment block as in ./src/Darcs/Patch/V1/Core.lhs:
        M ./src/Darcs/Patch/V2/Real.hs -66 +72


RealPatch -> RealPatch prim:
        M ./src/Darcs/Repository/Internal.hs -1 +1

Same + export existing data type "TreeWithFlattenPos", and introduce
"ArbitraryPrim" class to save some space in function signatures:
        M ./src/Darcs/Test/Patch/QuickCheck.hs -12 +18

Same:
        M ./src/Darcs/Test/Patch/Unit.hs -19 +20

Same + import aforementioned "TreeWithFlattenPos", and enforce proper
types on functions commuteTripleFromTree, commutePairFromTree,
commutePairFromTWFP, mergePairFromTree, mergePairFromTWFP, patchFromTree:

        M ./src/Darcs/Test/Patch/Unit2.hs -15 +38



Compile, tests ok, pushing them.
msg13634 (view) Author: darcswatch Date: 2011-02-05.18:55:21
This patch bundle (with 2 patches) was just applied to the repository http://darcs.net/.
This message was brought to you by DarcsWatch
http://darcswatch.nomeata.de/repo_http:__darcs.net_.html#bundle-f9b9f18599e567e4f8a1fc055ff45eb2aecfefc8
msg14073 (view) Author: darcswatch Date: 2011-05-10.17:36:44
This patch bundle (with 2 patches) was just applied to the repository http://darcs.net/reviewed.
This message was brought to you by DarcsWatch
http://darcswatch.nomeata.de/repo_http:__darcs.net_reviewed.html#bundle-f9b9f18599e567e4f8a1fc055ff45eb2aecfefc8
History
Date User Action Args
2010-11-23 23:37:27ganeshcreate
2010-11-23 23:38:35darcswatchsetdarcswatchurl: http://darcswatch.nomeata.de/repo_http:__darcs.net_.html#bundle-f9b9f18599e567e4f8a1fc055ff45eb2aecfefc8
2010-11-24 00:01:08darcswatchsetmessages: + msg13254
2011-02-02 00:49:16ghsetmessages: + msg13620
2011-02-05 18:52:14ghsetstatus: needs-review -> accepted
messages: + msg13632
2011-02-05 18:55:21darcswatchsetmessages: + msg13634
2011-05-10 17:36:44darcswatchsetmessages: + msg14073