generation of type signatures for Accessors
[email protected] Mon, 23 Mar 2009 21:22:51 -0500
| Newsgroups | gmane.comp.lang.haskell.template |
|---|---|
| Message-ID | <[email protected]> |
Hey, I'm trying to modify data-accessor-template 'deriveAccessors' to
generate type signatures so -Wall doesn't complain.
> data P = P { x_::Int, y_::String }
> $(deriveAccessors ''P)
should generate
> x :: Accessor P Int
> ...
> y :: Accessor P String
> ...
That seems pretty easy.
But
> data P a = P { x_::a, y_::a }
> $(deriveAccessors ''P)
should generate
> x :: forall a. T (P a) a
> ...
> y :: forall a. T (P a) a
> ...
I was able to write TH to generate code for the first situation, but it
failed for the second, and I don't feel confident about writing TH that
will work generally. How difficult is it?