[darcs-devel] [patch1919] Move PrimOf out of PrimPatchBase (and 1 more)

Ganesh Sittampalam bugs at darcs.net
Tue Sep 17 21:53:25 UTC 2019


New submission from Ganesh Sittampalam <ganesh at earth.li>:

I finished off my experiment to replace the Apply
type class with PrimApply/Effect, following on from the
discussion about Invertible here:

https://lists.osuosl.org/pipermail/darcs-devel/2019-September/020262.html

Apply stays as an empty class to avoid lots of UndecidableInstances.

As I mentioned in the previous mail the difficulty is code that
is overloaded on both prims and non-prims, that wants to call apply.
The solution is to make sure that prims continue to be instances
of Apply, so each needs a trivial instance of Effect, as well as
PrimOf prim ~ prim.

Overall I'm not really convinced it's an improvement, as we just
seem to be trading off messiness in Apply with messiness in
Effect/PrimOf. But perhaps it's at least moving it down a layer.
And of course we now have your 'unapply' idea which provides
a less invasive solution for Apply (Invertible p).

An alternative idea was to make a wrapper type 'ApplyablePrim'
so that we could have

instance PrimApply prim => Apply (ApplyablePrim prim)

and then change all the high-level places that call code that's
overloaded on prim/non-prim to add the wrapper when it is
passing a prim. But that turns out to be a lot of annoying
wrapping and I gave up.

2 patches for repository darcs-unstable at darcs.net:screened:

patch c86f011113412fc60b579238d19f8508ba5d4a19
Author: Ganesh Sittampalam <ganesh at earth.li>
Date:   Tue Sep 17 17:56:29 BST 2019
  * Move PrimOf out of PrimPatchBase
  
  Quite a few PrimPatchBase instances then turn out to be
  unnecessary.
  

patch ff23d0ace2cba00e29053a3c060f0b677ada8af3
Author: Ganesh Sittampalam <ganesh at earth.li>
Date:   Tue Sep 17 22:37:53 BST 2019
  * replace the apply method with applyPrimFL . effect

----------
files: move-primof-out-of-primpatchbase.dpatch, patch-preview.txt, unnamed
messages: 21441
nosy: ganesh
status: needs-screening
title: Move PrimOf out of PrimPatchBase (and 1 more)

__________________________________
Darcs bug tracker <bugs at darcs.net>
<http://bugs.darcs.net/patch1919>
__________________________________
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch-preview.txt
Type: text/x-darcs-patch
Size: 21512 bytes
Desc: not available
URL: <http://lists.osuosl.org/pipermail/darcs-devel/attachments/20190917/aa11477d/attachment-0002.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: move-primof-out-of-primpatchbase.dpatch
Type: application/x-darcs-patch
Size: 28234 bytes
Desc: not available
URL: <http://lists.osuosl.org/pipermail/darcs-devel/attachments/20190917/aa11477d/attachment-0003.bin>
-------------- next part --------------
.





More information about the darcs-devel mailing list