Fri Nov 24 04:21:20 PST 2006  [EMAIL PROTECTED]
  * Improve handling of implicit parameters
  
  A message to Haskell Cafe from Grzegorz Chrupala made me realise that
  GHC was not handling implicit parameters correctly, when it comes to
  choosing the variables to quantify, and ambiguity tests.  Here's the 
  note I added to TcSimplify:
  
  Note [Implicit parameters and ambiguity] 
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  What type should we infer for this?
        f x = (show ?y, x::Int)
  Since we must quantify over the ?y, the most plausible type is
        f :: (Show a, ?y::a) => Int -> (String, Int)
  But notice that the type of the RHS is (String,Int), with no type 
  varibables mentioned at all!  The type of f looks ambiguous.  But
  it isn't, because at a call site we might have
        let ?y = 5::Int in f 7
  and all is well.  In effect, implicit parameters are, well, parameters,
  so we can take their type variables into account as part of the
  "tau-tvs" stuff.  This is done in the function 'FunDeps.grow'.
  
  
  The actual changes are in FunDeps.grow, and the tests are
        tc219, tc219
  

    M ./compiler/typecheck/TcSimplify.lhs -6 +22
    M ./compiler/types/FunDeps.lhs -8 +25
_______________________________________________
Cvs-ghc mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to