[darcs-users] darcs patch: Resolve issue1229: strictify checkPristineAgainstSlurpy.

Eric Kow kowey at darcs.net
Wed May 27 13:40:10 UTC 2009


Hi Reinier,

Would you mind looking at this one? 

I imagine most of the work is in thinking about the patch comment :-),
but I'm not very experienced in thinking about laziness.  Are you?

> Wed May 27 15:18:20 CEST 2009  Petr Rockai <me at mornfall.net>
>   * Resolve issue1229: strictify checkPristineAgainstSlurpy.
>   
>   The code in replayRepository' in Darcs.Repository.Repair relies on being able
>   to catch exceptions that arise while running checkPristineAgainstSlurpy.
>   Unfortunately, due to unsafeInterleaveIO used in the SlurpDirectory code, the
>   exception does not get thrown until after the `catchall` is out of scope,
>   ie. when the "is_same" condition is evaluated (a supposed pure value, but
>   unsafeInterleaveIO has introduced latent exceptions into the equation). Making
>   the return from checkPristineAgainstSlurpy strict (using $!) forces execution
>   of the interleaved IO and trips the exception in the right context.

Resolve issue1229: strictify checkPristineAgainstSlurpy.
--------------------------------------------------------
>  checkPristineAgainstSlurpy repository@(Repo _ opts _ _) s2 =
>      do s1 <- slurp_recorded repository
>         ftf <- filetype_function
> -       return $ nullFL $ unsafeDiff (LookForAdds:IgnoreTimes:opts) ftf s1 s2
> +       return $! nullFL $ unsafeDiff (LookForAdds:IgnoreTimes:opts) ftf s1 s2

-- 
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/20090527/3601b96f/attachment.pgp>


More information about the darcs-users mailing list