[darcs-users] darcs patch: Simplify withCurrentDirectory. (and 3 more)

David Roundy droundy at darcs.net
Wed Aug 27 19:57:39 UTC 2008


On Wed, Aug 27, 2008 at 12:21:09PM -0700, Dmitry Kurochkin wrote:
> Sat Aug 23 04:47:12 MSD 2008  Dmitry Kurochkin <dmitry.kurochkin at gmail.com>
>   * Simplify withCurrentDirectory.

Applied, thanks!

> Mon Aug 25 13:29:41 MSD 2008  Dmitry Kurochkin <dmitry.kurochkin at gmail.com>
>   * Revert from debugFail to fail in HTTP fetchUrl and postUrl to prevent double error output.

This I rejected before:  the double error messages only happen if
darcs fails to catch the exception, but for debugging purposes it is
useful to see when exceptions happen even if they are caught.

> Wed Aug 27 13:18:33 MSD 2008  Dmitry Kurochkin <dmitry.kurochkin at gmail.com>
>   * Resolve issue966: fix apply_inv_to_matcher_inclusive.

Thanks! That was an awfully silly bug (and I almost certainly wrote it
myself).  Applied.

> Wed Aug 27 14:58:43 MSD 2008  Dmitry Kurochkin <dmitry.kurochkin at gmail.com>
>   * Refactor get_matcher and apply_inv_to_matcher functions from Darcs.Match module.

Applied, thanks, that looks like a nice refactor! For bonus points,
would you mind switching the Bool argument to an InclusiveOrExclusive
data type? e.g.

data InclusiveOrExclusive = Inclusive | Exclusive

Or maybe "Before" and "After" would be cleaner? I'm not sure.  But
just about anything is nicer than Bool.  The trouble is that there's
no way to see locally, looking at a given function, what the Bool
argument means.  I far prefer--particularly in cases like this where
none of these functions are exported (I believe)--to have a new data
type for this sort of flag, rather than using Bool.

David

P.S. For examples of this approach in darcs' code, see

Repository.lhs:data PorNP = NotPartial | IsPartial
Repository.lhs:data RepoSort = Hashed | Old
Patch/Prim.lhs:data FileNameFormat = OldFormat | NewFormat
Repository/Internal.lhs:data MakeChanges = MakeChanges | DontMakeChanges deriving ( Eq )
Repository/Internal.lhs:data UpdatePristine = UpdatePristine | DontUpdatePristine deriving Eq
Repository/Cache.lhs:data WritableOrNot = Writable | NotWritable deriving ( Show )
Repository/Cache.lhs:data OrOnlySpeculate = ActuallyCopy | OnlySpeculate deriving ( Eq )
Repository/Cache.lhs:data FromWhere = LocalOnly | Anywhere deriving ( Eq )
Repository/HashedIO.lhs:data ObjType = F | D deriving Eq
Repository/Prefs.lhs:data FileType = BinaryFile | TextFile


More information about the darcs-users mailing list