<div dir="ltr">Hi Martin,<div><br></div><div>Seems reasonable to me. It's a common dependency-breaking technique, akin to introducing an interface in OO-land. Did you also introduce a typeclass constraint on the type 'r' so you can call some methods on it too? If not then Process doesn't really depend on System at all.</div><div><br></div><div>Another thing to look for is that perhaps your System module splits into two bits, one low-level (defining types and so on) and one high-level (making use of everything in System and Process and Runner) and the two bits live at opposite ends of the dependency graph. I've found that quite a common situation to be in when splitting things up into modules too.</div><div><br></div><div>HTH,</div><div><br></div><div>David</div><div><br></div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On 25 October 2015 at 08:36, martin <span dir="ltr"><<a href="mailto:martin.drautzburg@web.de" target="_blank">martin.drautzburg@web.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello all,<br>
<br>
I just split up a program I'm working on into several source files and ran into the following difficulty:<br>
<br>
module Process implements Process which has a field Runner. Runner is a basically a function which alters a 'System'<br>
state. So Process needs Runner, Runner needs System and thus Process needs System.<br>
<br>
module System implements among others a collection of Processes (because Processes can alter their states). So System<br>
needs Process.<br>
<br>
Eh voila, I have a loop.<br>
<br>
What I did was to leave the type of the Runner unspecified in Process, i.e. I now have (Process r) where r is the type<br>
of the Runner. Thus Process no longer needs to know about System.<br>
<br>
This does work, but it feels strange and I'm a bit worried that this is an indication for a design flaw, but I cannot<br>
see it.<br>
_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe</a><br>
</blockquote></div><br></div>