Open kindaro opened 4 years ago
Another example is gmap
. Its behaviour depends on the order of traversal and does not make sense overall. For example, the last context to be traversed would always appear to be a leaf.
This can be remedied by making GDecomp
an instance of comonad. gmap
can then be defined in terms of extend
on non-empty graphs, and the definition for an empty graph is trivial to add. I rolled it out at home and it seems to work.
So, in principle it is not a problem to define reasonable maps, therefore I think it is fair to say that we have a bug. I should like to contribute some code to remedy this situation if the maintainers are willing to review and merge.
Consider this code:
Example:
As you see, we obtain a hanging edge.
I propose
gfiltermap
is improved so that validity of graphs is preserved.