[Hs-Generics] patch applied (generics): CrushRight working for
RepLib, not very satisfactory though.
Alexey Rodriguez Yakushev
alexey at cs.uu.nl
Tue Feb 12 14:12:21 EST 2008
Tue Feb 12 10:56:31 PST 2008 Alexey Rodriguez <alexey at cs.uu.nl>
* CrushRight working for RepLib, not very satisfactory though.
* crushRight is instantiated to perform operations on the
|a| elements of |WTree a w|. So the type class approach from the
paper does not work very well. It would mean a different
typeclass per kind. The same would happen if you would want
to obtain | (a->b) -> WTree a w -> WTree b w |.
* Okay, so let's forget about type classes right? This is still
painful. Let us see the problems:
* The representation of lists, for example, is something like
|R f [a]|, but in order to construct it, the function |rList1|
needs a function |f a| and another |f [a]|. The former is sort
of okay, you need to know how to process elements. The second
is tricky, but needed in RepLib: it is used for extension.
Normally you use typeclasses to simplify building the second.
So now instantiating crushRight has become quite more difficult
than in other approaches.
* The second problem has to do with a more complex type expression,
like [WTree a w], that is, a list of WTree's. Now, if you want
to build a list rep, you must a pass a function that works on
WTree's. This means that the representation of WTree's which builds
a representation for them, must be converted to a function that only
then can be passed to rList1, the builder of list representations.
You can see that in function r2crsh. Needless to say this makes things
more complicated than in other approaches.
More information about the Generics