[darcs-users] darcs patch: make an assumption in the pull code explicit

Eric Kow kowey at darcs.net
Wed Sep 9 14:34:51 UTC 2009


On Tue, Sep 08, 2009 at 22:50:22 +0100, Ganesh Sittampalam wrote:
> This patch is a step on the road towards adding type witnesses to Pull.lhs.

Applied, thanks!

> -      Sealed pw <- tentativelyMergePatches repository "pull" merge_opts
> -                   (reverseRL $ head $ unsafeUnRL us') to_be_pulled
> +      Sealed pw <- case us' of
> +                     h_us :<: NilRL -> tentativelyMergePatches repository "pull" merge_opts
> +                                        (reverseRL h_us) to_be_pulled
> +                     _ -> impossible -- we believe that get_common_and_uncommon should guarantee this,
> +                                     -- at least in this case. Error out if we're wrong, so that
> +                                     -- we find out. An alternative would be to do a concatRL of the whole
> +                                     -- us' list, but the code originally just took the head, and so we
> +                                     -- might instead introduce some subtle bug by doing a concat.

Blowing up explicitly and with an explanation why we're surprised sounds
like the kind of thing we should be doing systematically.  Hlint?

We have lots of fromJust in the code and that makes me a bit unhappy
(even if it's our homegrown fromJust with call to darcsBug and line
numbers).

-- 
Eric Kow <http://www.nltg.brighton.ac.uk/home/Eric.Kow>
PGP Key ID: 08AC04F9
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
URL: <http://lists.osuosl.org/pipermail/darcs-users/attachments/20090909/5beebde4/attachment.pgp>


More information about the darcs-users mailing list