[Template-haskell] RE: Question regarding template Haskell
ozone at algorithm.com.au
ozone at algorithm.com.au
Wed Sep 17 21:03:38 EDT 2003
On 17/09/2003, at 7:45 PM, Simon Peyton-Jones wrote:
> | Hi, I have a question regarding template Haskell: from
> | the documentation, I have the impression that it is
> | impossible to reify the type of the variable passed to
> | the template function, is this true? Or, in other
> | words, can I write a function like:
> |
> | getTupleCount :: a -> ExpQ
> |
> | getTupleCount x=
> | do
> | t <- (reifyType x)
> | --work on t
> | ...
If your 'x' variable is monomorphic, you can use the rType function
that Sean and I came up with, detailed here:
http://www.haskell.org/pipermail/template-haskell/2003-July/000128.html
That currently handles only 2-tuples, but it shouldn't be too hard to
extend it to work on any-size tuples. Let me know if you're having
problems.
--
% Andre Pang : trust.in.love.to.save
More information about the template-haskell
mailing list