[Template-haskell] RE: template-haskell
simonpj at microsoft.com
Thu Mar 3 13:46:06 EST 2005
| TH already has type syntax, as I can examine:
| f :: Num a => a -> a
| f a = a + 1
| So I am not sure I understand which bit of syntax is missing?
You'd like to be able to look at the Name 'a' and ask its type. Indeed,
you'd like to know the type of an arbitrary sub-expression. So the
change I had in mind was to attach a Type to a Name.
| \x -> ($(do_something [| \y -> x |]), x::Int)
| The type could be " a -> a " ... IE just looking at the anonymous
| functions it is fully polymorphic.
| You could veiw this as the most specific type available without
| information from outside the meta-quote, which is the only definition
| that makes sense to me at the moment.
So if you had
\(x::Int) -> ($(do_something [| \y -> x |])
you still want to get "a->a"? You definitely don't want to ignore the
types of things defined outside -- think of 'map' and (+)!
And what is this 'a' anyway? It's not bound anywhere.
One can make pragmatic decisions about these things, but I'd prefer a
More information about the template-haskell