-- STEP 4: Flip equations with variables on the right and not a variable on the
-- left.
flipEquations :: Equations -> Equations
flipEquations = S.map flipEquation
    where flipEquation (TEConst c, TEVar v) = (TEVar v, TEConst c)
          flipEquation (TEArrow t t', TEVar v) = (TEVar v, TEArrow t t')
          flipEquation e = e

-- STEP 5: Substitute
flipEquations :: Equations -> Equations
flipEquations = S.map flipEquation
    where flipEquation (TEConst c, TEVar v) = (TEVar v, TEConst c)
          flipEquation (TEArrow t t', TEVar v) = (TEVar v, TEArrow t t')
          flipEquation e = e

-- STEP 5: Substitute
flipEquations = S.map flipEquation
    where flipEquation (TEConst c, TEVar v) = (TEVar v, TEConst c)
          flipEquation (TEArrow t t', TEVar v) = (TEVar v, TEArrow t t')
          flipEquation e = e

-- STEP 5: Substitute