[darcs-devel] darcs patch: add context to HashedRepo.copy_repo (and 2 more)
David Roundy
droundy at darcs.net
Mon Mar 17 15:12:34 UTC 2008
On Wed, Mar 12, 2008 at 04:25:29PM -0700, Jason Dagit wrote:
> If it helps to see some of the possibilities and their type errors check
> this page:
> http://hpaste.org/6316
Thanks! This is indeed helpful. It looks like the primary problem is that
you need to change bits like this:
rp [(i,h),(il,hl)] =
do Sealed p <- createHashed h (const $ speculate h (reverse allis) >> parse i h)
Sealed rest <- rp [(il,hl)] -- LINE 177
return $ seal $ (i `patchInfoAndPatch` p) :<: rest
to bits like this
rp [(i,h),(il,hl)] =
do Sealed rest <- rp [(il,hl)] -- LINE 177
Sealed p <- createHashed h (const $ speculate h (reverse allis) >> parse i h)
return $ seal $ (i `patchInfoAndPatch` p) :<: rest
All I've done is reordered the two computations returning sealed data, so
that the type of the second can be dependent on the type of the first, and
this fixes the compile error. We can do this a bit more beautifully (in my
opinion) by introducing a higher-order function to do this sort of
combining of two actions that returned sealed results, which can also
introduce an unsafeInterleaveIO, which removes the inelegant change in
order of IO introduced by the above simple fix.
I think it'll be simplest if I record and push a little patch that makes
just this one change.
> I'm annotating it with some of the different things I have tried and their
> type errors. Maybe this will help step you through the difficulties I've
> had with getting read_repo_private to work.
Alas, this is some tricky stuff. I wish we could make the error messages
more obvious!
--
David Roundy
Department of Physics
Oregon State University
More information about the darcs-devel
mailing list