patch applied (ghc): Add left-to-right impredicative instantiation

Simon Peyton Jones <[email protected]>
Newsgroups gmane.comp.lang.haskell.cvs.all
Message-ID <20061213164112.GA30812__40234.5197195702$1166028083$gmane$org@cvs.haskell.org>
Wed Dec 13 08:29:15 PST 2006  [email protected]
  * Add left-to-right impredicative instantiation
  
  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
  
  

    M ./compiler/typecheck/TcExpr.lhs -37 +60
    M ./compiler/typecheck/TcMType.lhs -2 +1
    M ./compiler/typecheck/TcUnify.lhs -38 +75
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.