Hi Simon and fellow TH users,
Have the TH s you mentioned in your communities report now been fixed?
I've played around with reifying types and found that one can only reify names that have the following format: Name occ (NameG th_ns mod) which means that it's not possible to reify the Name "x" in the following expression: \x -> x + 3 since it is local. I realise that implementing such reification is a whole new can of worms. I'll give you an idea of what I want and then you can tell me whether it's infeasible or not. I might have a block of declarations like this ds = [d| f = .... g x = f .... x.... |] It would be extra nice if I could reify the type of "x" in the following code. Of course the problem is that we don't even know if "f" (or "g" for that matter) is going to type check until we've spliced it. So we can only reify "x"'s type at splice time. I need the ability to reify "x"'s type and then, based on the information I get back, transform the block of declarations, "ds", in a certain manner. So I would in effect be doing a kind of "speculative splice". But a splice of top-level declarations can only occur at the top level! What I'm suggesting would be a speculative splice inside the body of a function, something that will ONLY work when the DecQ that we are splicing only contains Names that refer to functions in other modules or within the DecQ. (That is, we can't have the functions referring to variables outside the DecQ but in the current module!). Fortunately, this condition is satisfied by the DecQs I wish to do reification in. I can understand why no one would want to write a "reify" function as described above. But the only reason I've been throwing functions in [d| |] brackets is because I can't reify entire modules. (We would have to bloat .hi files for this to be the case.) But, say this were possible. Then it would be MUCH easier to code a reify function that could return the types of local Names, because we would already known that the module which we are reifying type checks and then in the bloated .hi files we could simple annotate each occurrence of a Name with its type. This would be extremely useful to me. Cheers, Sean
participants (1)
-
Sean Seefried