Thu Jan 15 05:48:18 PST 2009  [email protected]
  * Robustify lookupFamInstEnv, plus some refactoring
  Ignore-this: 493fdbd370a714bf9677b16d2ba533d7
  
  This patch deals with the following remark
  
       Suppose we have
              type family T a :: * -> *
              type instance T Int = []
  
       and now we encounter the type (T Int Bool).  If we call
       lookupFamInstEnv on (T Int Bool) we'll fail, because T has arity 1.
       Indeed, I *think* it's a precondition of lookupFamInstEnv that the
       supplied types exactly match the arity of the type function.  But
       that precondition is neither stated, nor is there an assertion to
       check it.
  
  With this patch, lookupFamInstEnv can take "extra" type arguments in
  the over-saturated case, and does the Right Thing.
  
  There was a nearly-identical function lookupFamInstEnvUnify, which
  required the precisely analogous change, so I took the opportunity 
  to combine the two into one function, so that bugs can be fixed in one
  place.  This was a bit harder than I expected, but I think the result
  is ok.  The conflict-decision function moves from FamInst to FamInstEnv.
  Net lines code decreases, although there are more comments.
  
  
  

    M ./compiler/typecheck/FamInst.lhs -29 +3
    M ./compiler/types/FamInstEnv.lhs -72 +96

View patch online:
http://darcs.haskell.org/ghc/_darcs/patches/20090115134818-1287e-a50094beaaa7211634457cf6ebd53f6d3da3b1ab.gz

_______________________________________________
Cvs-ghc mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to