I was under the impression that the main reason GHC requires .hs-boot files is that nobody has had the time or inclination to make it resolve circular dependencies automatically, and not an intentional design decision to encourage &quot;good design&quot;.<br>
<br><div class="gmail_quote">On Tue, Sep 7, 2010 at 6:51 AM, Mathew de Detrich <span dir="ltr">&lt;<a href="mailto:deteego@gmail.com">deteego@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
I had the same issue zonks ago, and I resorted to using the hs-boot file method as well (which worked fine)<div><br></div><div>Which I guess brings me to my second point, is this something that GHC should do automatically when it sees circular dependencies? When I asked about it earlier on #haskell, I was told that its better that way because it discourages making bad design through circular dependencies (yet in my case and I assume the other cases as well, not using the hs-boot method would have made the design much worse). Are there any cases in particular where people would be encouraged to make interface design with circular dependencies (and that design be deemed as horrible) as opposed to what seems to be more realistic case where circular dependencies rarely crop up, and when they do they actually make the design better?</div>
<div><div></div><div class="h5">
<div><div><br><br><div class="gmail_quote">On Tue, Sep 7, 2010 at 1:48 PM, Ivan Lazar Miljenovic <span dir="ltr">&lt;<a href="mailto:ivan.miljenovic@gmail.com" target="_blank">ivan.miljenovic@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>On 7 September 2010 03:44, Edward Z. Yang &lt;<a href="mailto:ezyang@mit.edu" target="_blank">ezyang@mit.edu</a>&gt; wrote:<br>
&gt; Excerpts from Evan Laforge&#39;s message of Mon Sep 06 13:30:43 -0400 2010:<br>
&gt;&gt; I feel like the circular imports problem is worse in haskell than<br>
&gt;&gt; other languages.  Maybe because there is a tendency to centralize all<br>
&gt;&gt; state, since you need to define it along with your state monad.  But<br>
&gt;&gt; the state monad module must be one of the lower level ones, since all<br>
&gt;&gt; modules that use it must import it.  However, the tendency for bits of<br>
&gt;&gt; typed data to migrate into the state means it&#39;s easy for it to<br>
&gt;&gt; eventually want to import one of its importers.  And the state monad<br>
&gt;&gt; module gets larger and larger (the largest modules in my system are<br>
&gt;&gt; those that define state monads: 1186 lines, 706 lines, 1156<br>
&gt;&gt; lines---the rest tend to be 100--300 lines).<br>
&gt;<br>
&gt; I have used hs-boot files to this effect.  I separated data and functionality,<br>
&gt; and typeclasses, which must be in the same module as data or are considered<br>
&gt; orphaned, get definitions via a circular import.<br>
<br>
</div>I&#39;m just getting to the point where I have a similar problem.  I was<br>
thinking about splitting instances off from the classes (and telling<br>
GHC to not worry about orphaned instances for the instance-only<br>
modules) but then realised that some instance declarations would be<br>
circular as well, so I have to either use hs-boot files, define<br>
everything in one big module and then re-export them in ways that make<br>
sense or define all instances in one big module (at least for those<br>
types which have circular deps among instances) and re-export<br>
accordingly.<br>
<div><br>
--<br>
Ivan Lazar Miljenovic<br>
<a href="mailto:Ivan.Miljenovic@gmail.com" target="_blank">Ivan.Miljenovic@gmail.com</a><br>
<a href="http://IvanMiljenovic.wordpress.com" target="_blank">IvanMiljenovic.wordpress.com</a><br>
_______________________________________________<br>
</div><div><div></div><div>Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org" target="_blank">Haskell-Cafe@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
</div></div></blockquote></div><br></div></div>
</div></div><br>_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
<br></blockquote></div><br>