[Hs-Generics] type constructor genericity with regular

José Pedro Magalhães jpm at cs.uu.nl
Wed Sep 15 05:40:51 EDT 2010


Hi Jan,

On Wed, Sep 15, 2010 at 10:30, Jan Christiansen
<jac at informatik.uni-kiel.de>wrote:

> 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]
>

I'm not sure I fully understand what you're trying to do. Could you provide
typical use cases of your function, to several arguments of different types?


Cheers,
Pedro


>
> 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
> _______________________________________________
> Generics mailing list
> Generics at haskell.org
> http://www.haskell.org/mailman/listinfo/generics
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/generics/attachments/20100915/eb51ec1c/attachment.html


More information about the Generics mailing list