NoMonomorphismRestriction

Malcolm Wallace malcolm.wallace at cs.york.ac.uk
Fri Aug 7 17:03:16 EDT 2009


On 6 Aug 2009, at 12:18, Simon Peyton-Jones wrote:

> The paper makes the (somewhat radical) case for not generalising  
> local bindings at all; which would at a stroke remove most of the  
> issues of the MR.  (We'd still need to think about the top level.)

Only the other day I was writing some code that used a case analysis  
to build a value I hoped would be polymorphic, and it kept refusing to  
type-check.  Doing the case analysis on a different part of the value,  
then cutting and pasting the branch code multiple times did however  
seem to work.

Suddenly I remembered about the difference in generalisation between  
let- and lambda- bindings, and could solve the problem by changing the  
case to a let!  Instantly I could delete the error-prone cut-n-paste  
copies, and be more assured of the consistency of my code.

Regards,
     Malcolm



More information about the Haskell-prime mailing list