[darcs-devel] Getting a repository into a slurpy

Edwin Thomson edwin.thomson at businesswebsoftware.com
Thu Aug 24 10:11:55 PDT 2006


Hello

I'm finding darcs's diff command to be unusably slow for large 
repositories, so I'm trying to speed it up.  Darcs seems to do diff by 
making two copies of the repository, with different patches applied on 
each, which results in a lot of unnecessary work in the normal case 
where we only care about a small number of files.  It would be much 
better if it only touched the files it needs to.

It looks like it ought to be possible to make patch application use a 
SlurpMonad instead of the IO monad, and then pull the modifications out.

If I understand things correctly, I do something like this:
import Patch (apply)
apply_stuff_to_slurp_monad :: Stuff -> SlurpMonad ()
apply_stuff_to_slurp_monad stuff = do
   ...
   ...
   apply blah blah patch1
   apply blah blah patch2

then use it with something like:
get_file_contents :: OtherStuff -> [FilePath] -> IO ([PackedString])
get_file_contents otherstuff files = do
    s <- slurp pristine
    case (apply_stuff_to_slurp_monad stuff) >>= (MapM mReadFilePS files)) of
       SM func -> func s

I'm not good with Haskell, and I don't really understand monads well, so 
I'd like to know whether this approach is possible and/or sane, or 
whether there is a better way, before I spend too much time failing to 
implement it.

Edwin




More information about the darcs-devel mailing list