[Hs-Generics] Re: Scrap your boilerplate and Variants

Bruno Oliveira bruno.oliveira at comlab.ox.ac.uk
Wed Oct 25 08:36:38 EDT 2006


Hello Oleg,

>I have just committed the code for the alternative formulation of
>SYB3. It requires neither higher-rank types nor mutually recursive
>instances. Therefore, the code works even in Hugs (the original SYB3
>code does not work in Hugs). The files are in the directory
>SYB31/. The `final' code is dat2.hs (dat1.hs is the `intermediate'
>step, which makes it easy to understand `dat2.hs'). The code has
>comments that describe which part of the code is the `Library', which
>part of the code is the `generic function' (independent of the data
>structure), and which part of the code overrides some general
>processing of the generic function. The code has two examples; one of
>them is gsize, from the original SYB3 paper.

>I'd like to suggest two corrections to the SyB page:
>	first, rank-2 types are not necessarily required for all
>flavors of SYB

>	second, the original SYB3 imposes one more requirement:
>mutually recursive instances. It is rarely mentioned -- but not
>universally implemented (Hugs does not have it). SYB31 shows that one
>can get by without that requirement. At the ICFP05 talk, Simon
>Peyton-Jones asserted that recursive instances are essential. I have
>publicly expressed doubts. Simon Peyton-Jones said: if you think
>otherwise, show me the code. And so I did.

I think we need to define first what do we consider by an SyB-like approach.
I see that Ralf Lammel does not entirely agree that your code addressed 
exactly the same problems because, as I understand it, you miss the combinators 
like `everywhere` and `everything`. 

However, and also as Ralf Lammel points out your library may still be useful. I guess 
the question here is if this should be considered a variant of SyB.

Perhaps we can settle this question by imposing that variants need to define 
`everywhere` and `everithing` combinators (or mechanism that achieve the same with 
the same amount of work)?

Even if in the end we decide that this is a different approach altogether, we can 
discuss it as a different proposal. 

Cheers,

Bruno Oliveira




More information about the Generics mailing list