[prev in list] [next in list] [prev in thread] [next in thread] 

List:       darcs-devel
Subject:    [darcs-devel] [patch536] Maybefy arguments to rollback (and 5 more)
From:       Alexey Levan <bugs () darcs ! net>
Date:       2011-01-27 12:31:26
Message-ID: AANLkTikTSFmj4+=XfnvtOAga3dkJ-jgq6KrwyivjZ-Zp () mail ! gmail ! com
[Download RAW message or body]


Alexey Levan <exlevan@gmail.com> added the comment:

2011/1/27 gh <bugs@darcs.net>:
>
> gh <guillaumh@gmail.com> added the comment:
>
> Could you give a little explanation on why this bundle is interesting?

This is a refactoring which continues work started with patch178 on
lifting to the type level the differences between commands invoked
with no file arguments and with some arguments which may be invalid.
Typically, in absence of file args means that command applies to all
files.  This behaviour was implemented by pattern-matching on
aguments, and empty list was given a special meaning. In some cases,
however, this led to buggy behaviour, because after arg list was
checked for invalid entries and filtered accordingly, matching on it
could change the meaning of command in border cases.

patch178 fixes this problem by wrapping the arg list in the Maybe
datatype, so now the meaning of command is not affected by operations
on arguments.  Nothing means that command applies to all files, Just
fs means that "apply only to fs files", and Just [] means that
something is wrong.  (For the lack of better word, I called this
change "maybefy".)  In this patches, this change was applied to more
commands, not only those that caused bugs, and a couple of functions
from Darcs.Repository.State, which, too, gave special meaning to the
empty lists, were changed accordingly.

The only places that left keeping the old behaviour are the functions
in Darcs.SelectChanges.  Some of them have no meaning when applied the
empty list arguments, while others can be changed to support the
maybefied lists. For now I left their arguments wrapped in (fromMaybe
[]), and, if thiese pathes are applied, I'll change them, too.

In general, these changes better separate the meaning of commands wrt
the arguments they were called with, and will help to avoid the bugs
mixing up those meanings in future.

__________________________________
Darcs bug tracker <bugs@darcs.net>
<http://bugs.darcs.net/patch536>
__________________________________
_______________________________________________
darcs-devel mailing list
darcs-devel@darcs.net
http://lists.osuosl.org/mailman/listinfo/darcs-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic