<div dir="ltr">Ross Paterson wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="Ih2E3d">On Thu, Aug 14, 2008 at 08:00:25PM +0200, Sean Leather wrote:<br>

&gt; &nbsp; &nbsp; Well, the warning is right that you don&#39;t need to re-export module B:<br>
&gt; &nbsp; &nbsp; instances are implicitly exported. &nbsp;So you could just remove the export of<br>
&gt; &nbsp; &nbsp; &quot;module B&quot;, unless there&#39;s a reason to export it (such as, you might add<br>
&gt; &nbsp; &nbsp; some exported functions or data types to it later)<br>
&gt;<br>
&gt; Hmm, the disappointing result of removing module B from the export list<br>
&gt; is that now it doesn&#39;t show up in the Haddock-generated documentation<br>
&gt; for module A. Not that there was anything specific in B to document,<br>
&gt; because it&#39;s only instances. &nbsp;But I do want the user to know that<br>
&gt; importing A also imports B. Sigh... I suppose there&#39;s CPP if I really<br>
&gt; want it.<br>
<br>
</div>That shouldn&#39;t be necessary. &nbsp;Because instances are implicitly exported<br>
and imported, you&#39;ll really want to avoid orphan instances, so that the<br>
user can be sure that if both the class and the data type are in scope,<br>
so is the instance. &nbsp;But then the instance will be listed under both<br>
the class and the type in the Haddock documentation. &nbsp;It won&#39;t matter<br>
where the instance was defined, just as it doesn&#39;t matter where other<br>
stuff is defined, just where it is in scope.<br>
</blockquote><div><br>In my case, it does matter where instances are in scope. My library requires orphan instances by design. If the programmer imports the top-level module, then s/he gets a default set of instances. But the programmer has the option to import select modules and get a different set of classes and instances.<br>
<br>My goal was to put the default set of instances into a separate module and re-export that from a higher-level module. That way, it is more clearly documented where things are located.<br><br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Unfortunately Haddock does not allow doc comments to be attached to<br>
instances, but that&#39;s independent of whether the defining module is shown.<br></blockquote><div><br>Agreed. I am getting the impression that it would be nice if there were a lot of things that were more explicit about instances, both in Haskell and in Haddock.<br>
<br>Sean<br></div></div></div>