Skip to content
  • Simon Peyton Jones's avatar
    0ac2073a
    Make simplifyInfer generalise only over simple class constraints · 0ac2073a
    Simon Peyton Jones authored
    So we never infer
       f :: Eq (Tree a) => blah
    when there isn't an instance for Eq (Tree a).
    
    This fixes Trac #6022.
    
    It does represent a change in behaviour: certain (bizarre) programs
    will be rejected that were previously accepted. Specifically, if you
    have
    
       module A where
       f x = ...somethign needing (C T)...
    
       moudule B where
       import A
       instance C T
       test = f True
    
    Here the (C T) instance is provided "later".  But this is wierd; it
    would be better to give a type signature for f
       f :: C T => Bool -> Bool
    and then you'd be fine.
    0ac2073a
    Make simplifyInfer generalise only over simple class constraints
    Simon Peyton Jones authored
    So we never infer
       f :: Eq (Tree a) => blah
    when there isn't an instance for Eq (Tree a).
    
    This fixes Trac #6022.
    
    It does represent a change in behaviour: certain (bizarre) programs
    will be rejected that were previously accepted. Specifically, if you
    have
    
       module A where
       f x = ...somethign needing (C T)...
    
       moudule B where
       import A
       instance C T
       test = f True
    
    Here the (C T) instance is provided "later".  But this is wierd; it
    would be better to give a type signature for f
       f :: C T => Bool -> Bool
    and then you'd be fine.
Loading