[Template-haskell] query functions
Simon Peyton-Jones
simonpj at microsoft.com
Mon Jul 19 05:06:58 EDT 2004
Hmm. A full check, which involves type classes, requires the function
to consult the available instance declarations, so it'd have to be
monadic: Type -> Type -> Q Bool
Just getting types into the syntax tree at all, which Tim and I now plan
to do, is probably a higher priority at the moment; indeed, it may solve
the problem you originally wanted typeMatches for.
Simon
| -----Original Message-----
| From: template-haskell-bounces at haskell.org
[mailto:template-haskell-bounces at haskell.org] On
| Behalf Of Abraham Egnor
| Sent: 12 July 2004 18:58
| To: template-haskell at haskell.org
| Subject: [Template-haskell] query functions
|
| One bit of functionality I've recently found a need for is various
| query functions in TH, i.e. something like
|
| typeMatches :: Type -> Type -> Bool
|
| that tests if the second type is a valid specialization of the first
| one. The main need I've had for this is to test typeclass membership,
| but it would also be useful so that TH code can maintain a mapping of
| user-specified types to actions or suchlike.
|
| Any chance of something like this getting into a future TH revision?
|
| Abe
| _______________________________________________
| template-haskell mailing list
| template-haskell at haskell.org
| http://www.haskell.org/mailman/listinfo/template-haskell
More information about the template-haskell
mailing list