[darcs-users] darcs patch: code clarification (and 1 more)

Reinier Lamers tux_rocker at reinier.de
Tue Oct 28 10:14:52 UTC 2008


On Tuesday 28 October 2008 08:46:27 you wrote:
> I am not sure whether I understand what co_slurp does.
> co_slurp :: Slurpy -> FilePath -> IO Slurpy
>
> It takes a slurpy and a filepath to get me what? The co_slurp_helper
> confuses me, especially this:
>
>  case efs of
>         Right fs
>
>          | isDirectory fs || (isSymbolicLink fs && d' == ".") ->
>
>             do sl <- unsafeInterleaveIO
>                    $ unsafeInterleaveMapIO (co_slurp_helper fn') c
>                return $ Just $ SlurpDir d Nothing $ catMaybes sl
>         _ -> return Nothing
>
> Could you elaborate on your idea behind this suggestion?

I haven't looked at the source of co_slup. But in get_unrecorded_private in 
Darcs.Repository.Internal we see:

>    cur <- slurp_pending repository
>    work <- if LookForAdds `elem` opts
>           then do nboring <- if Boring `elem` opts
>                               then return $ darcsdir_filter
>                               else boring_file_filter
>                    slurp_unboring (myfilt cur nboring) "."
>           else co_slurp cur "."

This code  establishes two slurpies, one representing the pending state and 
one representing the working directory state -- just like your code does. But 
if David does it this way, he probably had a reason for it.

Regards,
Reinier



More information about the darcs-users mailing list