Hi David, On Fri, Nov 07, 2008 at 07:35:58 -0500, David Roundy wrote: > Here are some more patches I had lying around (I just amended them to > resolve some conflicts). Not important stuff, just type witness cleanups. > At least the cutting of dead code should be accepted.
Nice to see our witness coverage creeping forward. Having realised that Jason has a thesis to work on and that I shouldn't be asking any patch review from him, I've taken a look and applied these, thanks! enable type witnesses for show commands. ---------------------------------------- > + src/Darcs/Commands/Show.o \ Shouldn't ShowFiles be added to this list? > - where slurp :: RepoPatch p => Repository p -> IO Slurpy > + where slurp :: RepoPatch p => Repository p C(r u r) -> IO Slurpy For the interested, the three witnesses are recorded state, unrecorded state and tentative state, and here our slurp function expects a repository whose recorded and tentative state witnesses unify... which if I understand correctly means you can't accidentally pass in a repository from a function that uses type witnesses to say "this changes the tentative state" cut dead code from Unrecord. ---------------------------- > -rempatch :: RepoPatch p => Named p -> PatchSet p -> PatchSet p > -rempatch p (pps:<:ppss) = Hooray! We should maybe have some sort of automated dead-code detector to help us find these things make unrecord work with type witnesses. --------------------------------------- > + src/Darcs/Commands/Show.o src/Darcs/Commands/Unrecord.o \ Likewise, shouldn't Rollback be added to this list? > + FlippedSeal patches <- return $ if first_match opts > + then get_last_patches opts allpatches > + else FlippedSeal $ concatRL allpatches It's been explained to me countless times, but I still don't fully get the notion of sealing. The situation is that typically when working with patches, we use type witnesses to refer to two states for a patch, the 'before' and the 'after' state, which we can write p C(before after) I vaguely understand that sealing is useful because it gives us a way to say 'we only know things about some of these states', where with Sealed things, we only know about the 'before' state, and with FlippedSealed things, we only know about the 'after' state. Anyway, that's my very shaky take on things. > -get_last_patches :: RepoPatch p => [DarcsFlag] -> PatchSet p > -> RL (PatchInfoAnd p) > +get_last_patches :: RepoPatch p => [DarcsFlag] -> PatchSet p C(r) > + -> FlippedSeal (RL (PatchInfoAnd p)) C(r) So in the type witness code, when we talk about patch sets, we only pass in one type witness, because all patch sets start from nothing () > hunk ./src/Darcs/Commands/Unrecord.lhs 184 > - case get_common_and_uncommon (ps,p1s) of > - (_,us :\/: _) -> concatRL us > - where (Sealed p1s) = match_first_patchset opts ps > + case match_first_patchset opts ps of > + Sealed p1s -> case get_common_and_uncommon (ps,p1s) of > + (_,us :\/: _) -> FlippedSeal $ concatRL us The change is mostly just doing the sealing, the rest is whitespace stuff. -- Eric Kow <http://www.nltg.brighton.ac.uk/home/Eric.Kow> PGP Key ID: 08AC04F9
pgpjhPJ7B4cgg.pgp
Description: PGP signature
_______________________________________________ darcs-users mailing list [email protected] http://lists.osuosl.org/mailman/listinfo/darcs-users
