Mutually-recursive/cyclic module imports

Chris Smith cdsmith at
Thu Aug 21 09:59:20 EDT 2008

Ian Lynagh wrote:

Here's a late response to the comments on that wiki page.  It seems, to 
me, an extremely bad idea to remove defaulting *and* make that proposed 
change to (^) at the same time.  Code can currently depend on defaulting, 
and if it does, then integers most likely default to the Integer type, 
not Int.  If you just remove defaulting, then that code fails to compile, 
which is fine.  If you remove defaulting and change (^) at the same time, 
then that code compiles but means something different, which is 
definitely not fine.

It may initially seem like there's no problem, since no one would 
possibly want to use a number anywhere near 2 billion as an exponent for 
(^).  The problem here is that if one is allowing types to be inferred 
(which is certainly true, if we're worried about defaulting), then that 
use of the horribly unsafe Int type can propogate through the code.  Do I 
use this number as an exponent, and then also add it to x somewhere 
else?  Then x is an Int as well.  Then maybe I calculate (x * y) 
somewhere else?  Okay, now y is an Int.  And perhaps y is added to z?  
So, z is an Int.  But maybe z overflows... and now a nasty bug, a numeric 
overflow in z, was introduced without changing my code, without a 
warning, by the change to the type of (^) which is used four functions 


More information about the Haskell-prime mailing list