
On 10/25/06, Conor McBride
Moreover, I should very much like to have a token I can write in the place of an expression, such that on compilation, I receive a diagnostic giving me as much type information as possible about what must replace the token. When you try the old trick of making a deliberate type error to achive this effect, you often get less back than you might hope. Fine for genuine errors, but not enough to satisfy the ulterior motive.
I often want something similar but just a hair different. Sometimes I going along writing some code and I need a function or some monadic action but maybe I don't want to think yet how to define it. So I'll stick in the name of the function as a place holder, then quickly define the function to be undefined. This way I can try to compile my program to make sure all the defined code has the right types. This trick becomes even handier with Visual Haskell since it only displays type information if the whole module type checks. The obvious problem is that I may go off and forget to finish defining that undefined function. It would be nice if the compiler could say, "Oh, don't forget to finish writing that function stub!". In fact, maybe the special token in this case could be stub :: a, that is just designed to pass type checking and give an error as late in the compilation as possible. Hmm...maybe stub could be defined using some TH...Although, the error may still happen too soon. Ideally it would happen after all the relevant modules have been type checked. Jason