Skip to content
  • Simon Peyton Jones's avatar
    Fix TcLevel manipulation in TcDerivInfer.simplifyDeriv · 145f7c66
    Simon Peyton Jones authored
    The level numbers we were getting simply didn't obey the
    invariant (ImplicInv) in TcType
       Note [TcLevel and untouchable type variables]
    
    That leads to chaos. Easy to fix.  I improved the documentation.
    
    I also added an assertion in TcSimplify that checks that
    level numbers go up by 1 as we dive inside implications, so
    that we catch the problem at source rather than than through
    its obscure consequences.
    
    That in turn showed up that TcRules was also generating
    constraints that didn't obey (ImplicInv), so I fixed that too.
    I have no idea what consequences were lurking behing that
    bug, but anyway now it's fixed.  Hooray.
    
    (cherry picked from commit 261dd83c)
    145f7c66