24 Mar
2009
24 Mar
'09
2:22 a.m.
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?