[Hs-Generics] type constructor genericity with regular
Jan Christiansen
jac at informatik.uni-kiel.de
Wed Sep 15 09:02:52 EDT 2010
On 15.09.2010, at 13:41, José Pedro Magalhães wrote:
> Ah, I now see what you mean. Yes, you are right: regular does not
> abstract over type parameters, hence you can't do much to them. We
> have a similar library which does abstract over one parameter,
> though. It's called generic-deriving on Hackage, and used by the
> Utrecht Haskell Compiler [1, 2].
This looks quite interesting, thanks.
> However, in your application of shape to Tree, I see that you want
> to replace not only the parameters but also the recursive occurrences.
I don't see what you mean here.
> For curiosity: what do you want this shape function for?
This is probably a quite odd "application". I have proved some
properties about functions f :: [a] -> [a] by representing them by a
combination of (!!) and a function shape. That is, we have
f xs == map (!!xs) (shape xs)
where shape has the type [a] -> [Int] and simply numbers the elements
of the list. I want to generalize these statements to functions f :: F
a -> G a where F and G are arbitrary functors by providing
generalizations of shape and (!!) for arbitrary functors.
Cheers, Jan
More information about the Generics
mailing list