Proposal: refactor Arrow class
hesselink at gmail.com
Mon Jul 16 22:22:23 CEST 2012
On Mon, Jul 16, 2012 at 9:44 PM, Twan van Laarhoven <twanvl at gmail.com> wrote:
>>> Is either of these classes enough for the do/if sugar? Or do you also
>>> need (&&&) and (|||) for those?
>> For if or case you need premap and (|||).
>> For do you need premap and (&&&).
>> But if you have Category and premap, you can make (|||) from left,
>> and (&&&) from first.
> I showed that the weaker isoPremap is enough for `if`, and it also
> suffices for getting `(|||)` for `left` and vice versa.
> Since you are considering changing the class hierarchy, this is the
> time to also make other changes. Even if you don't use isoPremap or
> some of the other more general superclasses, it would still be good to
> have a nice hierarchy.
> And I do have two use-cases for these classes, namely isomorphisms and
> lenses. I am sure there are other examples of categories for which
> `arr` is too strong, but which do, for example, support `first`. The
> current `Arrow` class is too heavy weight. We already split of
> Category, but there are more things in between it and full arrows.
DSLs where you want to inspect the whole AST come to mind. Function
arguments cannot be inspected, so 'arr' is often problematic, while
allowing some specific functions is fine, as is manipulating tuples
with 'first' and 'second'.
More information about the Libraries