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

corentin.dupont at ext.mpsa.com corentin.dupont at ext.mpsa.com
Tue Sep 7 09:36:46 EDT 2010


That sort of code (stripped out):

In Game.hs:

data Game = Game { ...
                   activeRules :: [Rule]}

applyTo :: Rule -> Game -> Game
applyTo r gs = ...


In Rule.hs:

data Rule = Cond (Obs) Rule Rule
          | many others..
          deriving (Read, Show, Eq, Typeable)

data NamedRule = NamedRule { ...,
                             rule :: Rule }

isRuleLegal :: Rule -> NamedRule -> Game -> Bool
isRuleLegal = ...


In Obs.hs:

data Obs a where
     ProposedBy :: Obs Int   -- The player that proposed the tested rule
     ...


evalObs :: Obs -> NamedRule -> Game -> EvalObsType
evalObs = ...


Corentin




                                                                           
             Johannes                                                      
             Waldmann                                                      
             <waldmann at imn.ht                                         Pour 
             wk-leipzig.de>            haskell-cafe at haskell.org            
             Envoyé par :                                               cc 
             haskell-cafe-bou                                              
             nces at haskell.org                                        Objet 
                                       [Haskell-cafe] Re: circular imports 
                                                                           
             07/09/2010 14:00                                              
                                                                           
                                                                           
                                                                           
                                                                           




 <corentin.dupont <at> ext.mpsa.com> writes:

> I had recently a really hard time splitting up my program into parts!
> The natural, business-oriented split up drove me into a deadly circular
> dependency.

perhaps you could post your code (enough of it to understand the problem)?

J.W.


_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe at haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe




More information about the Haskell-Cafe mailing list