Export lists in modules

John Hughes rjmh at cs.chalmers.se
Thu Feb 23 07:28:31 EST 2006

>Subject: Re: Export lists in modules
Type signatures currently do more than state the type of a variable. 
They potentially (i) enable polymorphic recursion, and (ii) disable the 
monomorphism restriction, thus losing sharing. It would be very strange 
if a type signature *in an export list* were to have these effects--the 
export list surely should not change the way a module is compiled and 
type-checked. One good principle is that commenting out the export list 
should not change the way any definition is compiled, only what is 
exported. After all, commenting out the exports (so that all definitions 
can be tested) is a common step when debugging a module.

I would conclude that polymorphic recursion should be enabled only if a 
type signature appears *in the body of the module*, similarly the M-R 
should be disabled only if an overloaded type signature appears in the 
body of the module.

The same principle should apply to any  other type signatures that 
change the way a definition is type-checked, if they are included in 
Haskell', such as rank-2 or rank-N type signatures.


More information about the Haskell-prime mailing list