RE: query functions
"Simon Peyton-Jones" <[email protected]>
| Newsgroups | gmane.comp.lang.haskell.template |
|---|---|
| Message-ID | <4B93206CA3C55D4F96A61C9B1DC80DE3015FB564@EUR-MSG-03.europe.corp.microsoft.com> |
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: [email protected] [mailto:[email protected]] On | Behalf Of Abraham Egnor | Sent: 12 July 2004 18:58 | To: [email protected] | 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 | [email protected] | http://www.haskell.org/mailman/listinfo/template-haskell