Skip to content
  • Simon Peyton Jones's avatar
    Allow multiple case branches to have a higher rank type · bcb177dd
    Simon Peyton Jones authored and Marge Bot's avatar Marge Bot committed
    As #18412 points out, it should be OK for multiple case alternatives
    to have a higher rank type, provided they are all the same.
    
    This patch implements that change.  It sweeps away
    GHC.Tc.Gen.Match.tauifyMultipleBranches, and friends, replacing it
    with an enhanced version of fillInferResult.
    
    The basic change to fillInferResult is to permit the case in which
    another case alternative has already filled in the result; and in
    that case simply unify.  It's very simple actually.
    
    See the new Note [fillInferResult] in TcMType
    
    Other refactoring:
    
    - Move all the InferResult code to one place, in GHC.Tc.Utils.TcMType
      (previously some of it was in Unify)
    
    - Move tcInstType and friends from TcMType to Instantiate, where it
      more properly belongs.  (TCMType was getting very long.)
    bcb177dd