• simonpj's avatar
    [project @ 2003-02-26 17:04:11 by simonpj] · c86e9006
    simonpj authored
    	Improve higher-rank type inference
    Yanling Wang pointed out that if we have
    	f = \ (x :: forall a. a->a). x
    it would be reasonable to expect that type inference would get the "right"
    rank-2 type for f.  She also found that the plausible definition
    	f :: (forall a. a->a) = \x -> x
    acutally failed to type check.
    This commit fixes up TcBinds.tcMonoBinds so that it does a better job.
    The main idea is that there are three cases to consider in a function binding:
      a) 'f' has a separate type signature
    	In this case, we know f's type everywhere
      b) The binding is recursive, and there is no type sig
    	In this case we must give f a monotype in its RHS
      c) The binding is non-recursive, and there is no type sig
    	Then we do not need to add 'f' to the envt, and can
    	simply infer a type for the RHS, which may be higher