
Hi, I have some problems with cyclic dependencies. Module Foo: data Foo = Foo { bar :: Bar } Module Bar: class BarClass b where barfun :: b -> Foo -> Foo data Bar = forall b . (BarClass b) => Bar b Obviously I have to import both modules mutually. My workaround was to add a further type variable to BarClass. class BarClass' b f where barfun :: b -> f -> f data Bar' f = forall b . (BarClass' b f) => Bar b This seams to be fine, but in my case it is a bit more compicated. I need a Read instance of Foo. Therefor I have to implement the Read instance for the existential type Bar by my own and need to know about the instanced of BarClass. Unfortunately, the instances of BarClass need Foo and I have a cycle again. Thanks, Georg
participants (1)
-
Georg Martius