[darcs-devel] [patch1911] WIP: use Prim patches in rebase toedit

Ganesh Sittampalam bugs at darcs.net
Sun Sep 22 09:51:15 UTC 2019


Ganesh Sittampalam <ganesh at earth.li> added the comment:

> Just one side remark for now:
> 
> mapMB_MB :: (p wX wY -> q wX wY) -> Maybe2 p wX wY -> Maybe2 q wX wY
> mapMB_MB _ Nothing2 = Nothing2
> mapMB_MB f (Just2 v) = Just2 (f v)
> 
> I guess it's time to finally introduce
> 
> class Functor2 f where
>   fmap2 :: p wX wY -> q wX wY -> f p wX wY -> f p wX wY
> 
> Off the top of my head I can think of instances for at least Maybe2, FL,
> RL, Named, PatchInfoAndG; there are probably more.
> 
> I may give this one a try.

To work for FL+RL, the type would need to be:

(forall wA wB . p wA wB -> q wA wB) -> f p wX wY -> f p wX wY

I think that's fine for mapMB_MB too in practice, but it does show a
problem of working with witnesses - you sometimes end up with subtle
differences in types of things that inhibits polymorphism. I'm not sure
if it would be acceptable for Named and PatchInfoAndG, it depends on how
the existing functions are used.

BTW I am planning on putting Maybe2 in Darcs.Patch.Witnesses somewhere,
either .Ordered or a new Darcs.Patch.Witnesses.Maybe.

__________________________________
Darcs bug tracker <bugs at darcs.net>
<http://bugs.darcs.net/patch1911>
__________________________________


More information about the darcs-devel mailing list