Hi,
On Thu, 11 Nov 2010, Florent Becker wrote:
type CommuteFunction = FORALL(x y) (Patch :< Patch) C(x y) -> Perhaps
((Patch :< Patch) C(x y))
type MaybeCommute = FORALL(x y) (Patch :< Patch) C(x y) -> Maybe
((Patch :< Patch) C(x y))
+
+revCommuteFLId :: MaybeCommute -> (FL Patch :< Patch) C(x y) -> Maybe
((Patch :< FL Patch) C(x y))
+revCommuteFLId _ (NilFL :< p) = return (p :< NilFL)
+revCommuteFLId commuter ((q :>: qs) :< p) = do
+ p' :< q' <- commuter (q :< p)
+ p'' :< qs' <- revCommuteFLId commuter (qs :< p')
+ return (p'' :< (q' :>: qs'))
+
Why not in Permutations.hs?
Agreed, that would probably be a better place for it, but I've been trying
to write patches that do one thing at a time and have minimal local
changes. Somewhere in my invisible and unwritten plans for Darcs.Patch is
the idea of rationalising stuff like this (building complex commute
functions out of simpler ones). [The existence of such plans in my head
should of course not constrain anyone else from doing something that seems
sensible to them in the meantime, though I'd also be happy to discuss
things.]
hunk ./src/Darcs/Patch/Show.lhs 53
+-- | This type is used to tweak the way that 'FL p' is shown for a
+-- given 'Patch' type 'p'. It is needed to maintain backwards
compatibility
+-- for V1 and V2 patches.
+data ShowFLBehavior p
+ = ShowFLDefault -- ^braces around all lists
+ | ShowFLV1 -- ^braces around all lists except singletons
+ | ShowFLV2 -- ^no braces around lists
ShowFLDefault would be for debug output?
My intention at the time of writing this patch was for ShowFLDefault to be
the standard for V3 and beyond. That's since changed though due to the
problems I ran into: the new default behaviour is the same as the V2
behaviour.
-identifyDarcs1Repository :: [DarcsFlag] -> String -> IO (Repository
Patch C(r u t))
+identifyDarcs1Repository :: [DarcsFlag] -> String -> IO (Repository
(FL Patch) C(r u t))
identifyDarcs1Repository opts url =
do er <- maybeIdentifyRepository opts url
case er of
we really should drop the 1 in identifyDarcs1Repository, given that it
comes up in code paths for darcs2 repositories.
Agreed (though the type means it really is about darcs 1 repos, and then
we hack the resulting Repository value later on)
I've actually already made this change as part of a pending series of
patches to abstract over Prim; I'll submit that as soon as I can (and
perhaps once the review backlog is cleared a bit more, which I do intend
to help with!)
Ganesh
_______________________________________________
darcs-users mailing list
darcs-users@darcs.net
http://lists.osuosl.org/mailman/listinfo/darcs-users