Using a Typ as a Type
7 Aug
2003
7 Aug
'03
9:09 p.m.
Is there any way that I can use a Typ (i.e., a reified Type) as a Type inside a template so that I can use the Typ to select an instance of a type class. For example, I'd like to be able to write (this doesn't parse): $(test [t[ Float ]] "1.0") test :: Q Typ -> String -> Q [Dec] test qty x = do ty <- qty print (read x :: $ty) -- The ':: $ty' part is the important bit return [] I've been going back and forth on whether or not this fits the existing TH framework or represents a major excursion into multi-stage templates. I'd be willing to implement this feature if it fits the existing TH framework (i.e., it doesn't require a complete reimplementation of TH). -- Alastair Reid
8177
Age (days ago)
8177
Last active (days ago)
0 comments
1 participants
participants (1)
-
Alastair Reid