| | 395 | |
| | 396 | = API access to Holes = |
| | 397 | |
| | 398 | Another open question is how to |
| | 399 | programmatically get information back from GHC. It seems that so far we are |
| | 400 | just thinking about printing a warning message from the compiler. But in order |
| | 401 | to write something like Agda-mode, I guess we ultimately want to expose this in |
| | 402 | the GHC API, so programs like [ghc-mod |
| | 403 | http://www.haskell.org/haskellwiki/Haskell_mode_for_Emacs#ghc-mod ghc-mod] can display |
| | 404 | the holes information and let the user move between them. |
| | 405 | |
| | 406 | This seems tricky since it doesn't fit completely with the way the GHC API is |
| | 407 | currently set up. I think there are two options: |
| | 408 | |
| | 409 | 1. Treat them like warning messages are currently handled, and extend the |
| | 410 | "listener" callback which gets called during compilation to have messages about |
| | 411 | holes as well as warnings in general. |
| | 412 | |
| | 413 | However, this is not very uniform: the list of holes in a module is |
| | 414 | more similar to the list of top-level bindings in the modules, so the API for |
| | 415 | querying them should be similar. |
| | 416 | |
| | 417 | 2. Treat them like top-level bindings, and have a set of methods for querying |
| | 418 | them that way. |
| | 419 | |
| | 420 | Currently, GHC is set up so that each time you compile a module a .hi is |
| | 421 | generated, and all the API methods for querying for module information looks at |
| | 422 | the .hi file. So this alternative entails modifying the .hi file format to also |
| | 423 | have a section about holes. |
| | 424 | |
| | 425 | What is the best way to do this? |