[Haskell-cafe] circular imports

Edward Z. Yang ezyang at MIT.EDU
Mon Sep 6 13:44:08 EDT 2010

Excerpts from Evan Laforge's message of Mon Sep 06 13:30:43 -0400 2010:
> I feel like the circular imports problem is worse in haskell than
> other languages.  Maybe because there is a tendency to centralize all
> state, since you need to define it along with your state monad.  But
> the state monad module must be one of the lower level ones, since all
> modules that use it must import it.  However, the tendency for bits of
> typed data to migrate into the state means it's easy for it to
> eventually want to import one of its importers.  And the state monad
> module gets larger and larger (the largest modules in my system are
> those that define state monads: 1186 lines, 706 lines, 1156
> lines---the rest tend to be 100--300 lines).

I have used hs-boot files to this effect.  I separated data and functionality,
and typeclasses, which must be in the same module as data or are considered
orphaned, get definitions via a circular import.


More information about the Haskell-Cafe mailing list