On Tue, 15 Jul 2008, Chris Kuklewicz wrote:

Consider these 3 files:

A.hs:
module A(A) where
import B(B)
data A = A B

B.hs
module B(B) where
import A(A)
data B = B A

Main.hs
module Main where
import A
import B
main = return ()


Sooner or later you want generalize your datatypes. Then you can define
   data A b = A b
and you do not need to import B any longer. I do not know if this is a generally applicable approach, but it helped me in some cases. There is still a problem with mutually recursive classes. In the one case where I had this problem, I could solve it the opposite way, namely by turning one type variable into a concrete type, which could represent all values one could represent with the variable type.
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to