Thu Oct 27 10:05:16 EDT 2011


How to name this pattern?

What happens a lot to me when programming with type classes in Haskell
is that I run into commutation problems, meaning that I run into
operations like

         a (b t) -> b (a t)

and their inverse that encode a morphism between the two types with
different nesting order, basically saying that a and b commute.

In general this doesn't hold: such functions usually do something
significant, and might overall not be invertible.

However in other cases the morphisms might be bidirectional and
somewhat trivial.  Is there a way to represent such a morphism in an
abstract way?  I.e. is there a way to automatically derive "trivial
morphisms" for cummutative type constructors?

Sorry, no example as this is just a vague hunch..