Skip to content
  • Simon Peyton Jones's avatar
    In approximateWC, do not float contraints out of an implication with equalities · 6a58aa0c
    Simon Peyton Jones authored
    Jacques Garrigue pointed out that GHC 7.6 was accepting GADT programs
    that our OutsideIn paper said would be rejected.  The reason was that
    approximateWC was being too aggressive about floating; see Note
    [approximateWC] in TcSimplify.
    
    This simple patch fixes that, but it is (of course) not backward
    compatible; a few GADT programs that were (erroneously) accepted
    before are now rejected, and will need a type signature.  This could
    be under flag control, but I'd rather just make it compulsory.
    
    Example
       data T a where
         TInt :: T Int
         MkT :: T a
    
       f TInt = 3::Int
    
    Here f (with no type signature) is current accepted, with inferred type
     f :: T a -> Int
    but should be rejected
    6a58aa0c