Skip to content
  • Simon Peyton Jones's avatar
    Add left-to-right impredicative instantiation · a2fcf3aa
    Simon Peyton Jones authored
    People keep complaining, with some justification, that
    
    	runST $ foo
    
    doesn't work.  So I've finally caved in.  The difficulty with the above
    is that we need to decide how to instantiate ($)'s type arguments based 
    on the first argument (runST), and then use that info to check the second
    argumnent.  There is a left-to-right flow of information.
    
    It's not hard to implement this, and it's clearly useful.  The main 
    change is in TcExpr.tcArgs, with some knock-on effects elsewhere.
    
    I was finally provoked into this by Trac #981, which turned out, after some
    head-scratching, to be another instance of the same problem.
    
    (There was some bug-fixing too; a type like ((?x::Int) => ...) is a polytype
    even though it has no leading for-alls, but the new TcUnify code was not 
    treating it right.)
    
    Test for this is tc222
    
    a2fcf3aa