[Template-haskell] generation of type signatures for Accessors
brian at lorf.org
brian at lorf.org
Mon Mar 23 22:22:51 EDT 2009
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?
More information about the template-haskell
mailing list