[Haskell] A haddock question
simonmar at microsoft.com
Mon Oct 10 08:06:33 EDT 2005
[please excuse premature send.]
On 10 October 2005 12:44, Benjamin Franksen wrote:
> I have a module with a public class plus some instances for public
> data types. In addition, I use this class inside another module where
> I declare local (module private) data types and make them instances of
> the class. I had expected that haddock (I am using 0.7) will list in
> the documentation only instances of data types that are exported, but
> instead all instances are listed.
> Is there a way to persuade haddock to list only instances of data
> types that are actually visible to the user?
Haddock's support for instances is somewhat braindead - it just reports
all the instances it can find for a given class in the entire set of
modules it is processing. In particular, Haddock makes no attempt to
tell you how to bring these instances into scope: they might not be
available from the module that exports the class, or the type(s),
involved in the instance.
Haskell makes this quite hard: an instance is available if it is
provided by the transitive closure of an imported module. We clearly
don't want to report all the available instances in every module's
documentation, however. We probably don't want to document every
module from which an instance is available either. Nevertheless, doing
one of these two would be "correct". I'm open to suggestions.
Benjamin: your example is probably more simple, Haddock probably just
shouldn't be exposing those instances if they refer to non-exported
types, I just wanted to point out the more general problem.
More information about the Haskell