George Russell <[EMAIL PROTECTED]> wrote, > "Manuel M. T. Chakravarty" wrote: > > IMHO it would be much more important to think about a > > mechanism for automatically extracting all the interface > > information (including the interface comments) from a > > Haskell module. Something like an automatically generated > > Modula-2 definition module that defines and explains the > > interface without forcing the reader to wade through the > > implementation. > A less technological solution which has been suggested before would be an > extension to the Haskell language to allow type annotations in > module export lists. This would allow a considerable part of the > interface to be documented and automatically checked in one central > place. I could then write a typical Haskell module in the following order: > (1) module export list, listing types and comments for all values; > (2) import list; (3) interface and type declarations; (4) all non-trivial code. > Then it is easy to get at the interface (sections (1) & (3)), but at the > same time you don't have to duplicate the same stuff in different places. Unfortunately, this has exactly the same problem as Modula-2 has: You have to duplicate types and comments for all exported entities, or leave the implementation `naked'. (In M-2, you had to repeat the type and people usually did not provide comments in the implementation module.) The implementor wants comments, type signature, and implementation, but the user of a module (most of the time) only wants the type signature and comments. Thus, it seems the best solution is to automatically strip out the implementation (and all implementation-specific comments) to generate a user-level interface. Manuel
