"Manuel M. T. Chakravarty" wrote:
> 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.
I appreciate my solution is not ideal. All I claim is that it is
better than the current situation. I tried to deal with the problem
of duplicating types by suggesting that if you exported type definitions
you put the type definition near the top of the module definition.
That way the module user only has to page down a little bit to find the
type definition. In any case, it is usually bad style to export large
types anyway, and I don't mind discouraging it.
The idea of having an automatic interface generator is attractive but does
have its problems. There are two things you'd have to do:
(1) write it. I _suspect_ the GHC implementors would not find my solution
very hard to add on for example. But an automatic interface generator
seems to me slightly trickier.
(2) persuade other people to learn it.
Note for example that you do need to extend the language, or at least its
parsing, a bit. If these automatically generated interfaces are to be
any good,they've got to include comments, and that means you need a way of
saying "This comment is a user-level comment for this value/type".
Incidentally my solution also has difficulty with instance declarations. I
don't know what you do about those. But wouldn't it be nice if
Manuel's pretty-printable interface files really existed and could
be converted to and from GHC .hi files?