[darcs-users] darcs record using darcs lib: First Experiences

Benedikt Huber benjovi at gmx.net
Tue Mar 23 00:40:00 UTC 2010


Hi all,
davidm and me started working on a Mac GUI for darcs record, directly
interfacing darcs as a library. The graphical interface did not make too 
much progress yet, but at least we got some experiences with the 
interface for an external darcs record (encapsulated during work as a 
'Darcs.Lib' layer).

* Used approach for external darcs record

- extract 'PatchChoice' set of new primitive patches from repo
- use sealed, tagged primitive patch list for building graphical 
representation
- use PatchChoice's forceFirst (select) and forceLast (skip) to update
- use getSlot (status) to query the status (select|undecided|skip)
- when finished, pass a list of pairs (primitive patch hash, status) to 
record ...
- ... which then either records the patches or fails because of 
concurrent modifications

* Type witnesses
Type witnesses are really neat when writing darcs library code and 
helped to prevent some mistakes there (escaping of type variables). But 
they are also inconvenient to build at the moment and not easy to 
understand at the beginning.
At the GUI / external tool level, we did not need them so far, because 
of working with sealed primitive patches and PatchChoice only. The 
Sealed2 type was fine, but added some clutter, requiring 'unseal2' at 
many places. Maybe using darcs library at a level so low it requires 
type witnesses will easily lead to corrupted repositories anyway.

* Hierarchical Modules
It seems unacceptable to have top-level modules like Printer and Sha1 in 
the darcs lib. Why not e.g. Text.PrettyPrint.Darcs or Darcs.Utils.Printer ?

* Performance?
The performance of PatchChoice use in this way was ok, but probably not 
good enough for large repos. 'yes n | my_record' takes roughly 3.6s for 
the last 800 primitive darcs patches recorded, updating the PatchChoice 
set in each step ('yes n | darcs record' needs 4.1s with HEAD darcs).

Any suggestions or feedback welcome,

cheers, benedikt (visq)



More information about the darcs-users mailing list