• simonpj's avatar
    [project @ 2002-03-08 15:50:53 by simonpj] · a170160c
    simonpj authored
    --------------------------------------
    	Lift the class-method type restriction
    	--------------------------------------
    
    Haskell 98 prohibits class method types to mention constraints on the
    class type variable, thus:
    
      class Seq s a where
        fromList :: [a] -> s a
        elem     :: Eq a => a -> s a -> Bool
    
    The type of 'elem' is illegal in Haskell 98, because it contains the
    constraint 'Eq a', which constrains only the class type variable (in
    this case 'a').
    
    This commit lifts the restriction.  The way we do that is to do a full
    context reduction (tcSimplifyCheck) step for each method separately in
    TcClassDcl.tcMethodBind, rather than doing a single context reduction
    for the whole group of method bindings.
    
    As a result, I had to reorganise the code a bit, and tidy up.
    a170160c