| 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 Sean's reply and Alastair's reply to that, and I still can't figure out what you are trying to do. The above code looks weird. test is a Q [Dec], but you are doing a print in the middle of it. Why? In principle you can certainly say: $(test [t| Float ]] "2.0") test :: Q Type -> String -> Q [Dec] test qty x = [| read (x::$qty) |] so that $(test [t| Float ]] "2.0") ===> read ("2.0" :: Float) TH doesn't support type splices today; that's one of the things I'm actively working on. But I'm not sure if this is what you meant. Simon