Re: Réf. : [Haskell-cafe] Re: circular imports

Henning Thielemann lemming at henning-thielemann.de
Tue Sep 7 10:42:13 EDT 2010


On Tue, 7 Sep 2010, Johannes Waldmann wrote:

> Henning Thielemann <schlepptop <at> henning-thielemann.de> writes:
>
>> As I see there is no cycle in the types. How about defining Game, Rule,
>> Obs in private modules, like Private.Game, Private.Rule, Private.Obs,
>> and implementing the functions in public modules like Game, Rule, Obs ?
>
> I guess that conflicts with the advice of putting the
> functions (behaviour) close to the data that it concerns.

Of course, the public module Game shall export the Game type from 
Private.Game and so on. That is from the perspective of the Game package 
user, the Game type and related functions can be imported from the same 
module. The inconvenience of defining the Game type and its functions in 
distinct modules exists only for corentin.dupont but not for the user of 
his library.


More information about the Haskell-Cafe mailing list