Mutually-recursive/cyclic module imports

Isaac Dupree isaacdupree at
Fri Aug 15 11:35:37 EDT 2008

Ian Lynagh wrote:
> I'm not sure if defaulting actually makes this worse, but regardless, I
> think we should seriously consider removing defaulting anyway:

Oh, actually, I agree with that proposal to remove 
defaulting.  Maybe we should try implementing that and see 
how much things break.  I imagine most uses can be solved 
by, if nothing else, adding local functions with 
more-constrained types, a bit similar to the (^) change.

I noticed that depending on the resolution of
, we might have a different sort of defaulting that examines 
exactly a whole module (which could also make it harder for 
my cyclic-module proposal to avoid recompilation? not sure)

If we remove defaulting and the monomorphism restriction 
*and* don't add any other per-module semantics, then we get 
the module system out of the way of the semantics, which 
would make me very happy!  There are a few GHC extensions 
that are still unfortunately per-module -- e.g. 
OverlappingInstances perhaps ought to be a notation or 
pragma on a class, rather than affecting all classes that 
happen to be defined in the module.  (Pragmas aren't 
supposed to have an effect if they're not recognized; but 
sometimes people put OverlappingInstances on a class not 
because they're planning to make any such instances, but to 
allow users to define such instances; in which case the 
class and stock instances really can compile even in 
compilers that don't support overlapping instances)


More information about the Haskell-prime mailing list