RE: Template Haskell reification

| Why is it that one can't reify top level function declarations? At the | moment it only seems that we can reify type declarations. No immediate | reason for this seems to spring to mind, but there may be one. [I'm interested to know something about your application, incidentally.] Several reasons conspire. a) Inconvenience (it's a little tiresome to implement) b) It would be particularly difficult to get the definition of a function defined in another module (because we'd have to read that entire module too). This is not true of data type declarations, which travel in interface files, so there is no ugly cross-module issue to worry about. c) I'm not quite clear what you'd expect to get. If we have f = ...f... it's easy enough. If you have mutual recursion f = ...g... g = ...f... do you get just f's definition, or g's too? If it's a pattern binding (f,g) = ... you can't avoid getting both. And even if it's a simple, non-recursive defn f = ....g.... (where g is defined earlier), I wonder whether there should be some way to get at g's definition too.
participants (1)
-
Simon Peyton-Jones