[Hs-Generics] type constructor genericity with regular

Jan Christiansen jac at informatik.uni-kiel.de
Wed Sep 15 04:30:29 EDT 2010


Hi,

I want to define a function which is generic for all unary type  
constructors using the regular package. More precisely, I want to  
define a function like the following, which replaces every polymorphic  
component by the position of the component in the generic  
representation.

   shape :: (Regular f, Shape (PF f)) => f a -> f [Bool]

Is it correct that it is not possible to implement a function like  
this using regular? Or do I miss something?

I have implemented the function by using different representation  
types K, I and so forth that take an additional argument. Furthermore  
I have added an additional type to mark the polymorphic component.

Thanks, Jan


More information about the Generics mailing list