equations :: (Ord a, FreshPickable a)
          => TEContext a
          -> LambdaTerm a
          -> InferenceState (TEContext a, Int, Equations)
          -- -> State UsedTypeVars (TEContext a, Int, Equations)
equations gamma0 (Var x) =
  case varTypeJudgment x gamma0 of
       Just (_, t) -> do newV <- newTypeVar
                         return (gamma0, newV, singleton (TEVar newV, t))
       Nothing     -> do newV <- newTypeVar
                         return (strongInsert (x, TEVar newV) gamma0,
                                 newV, fromList [])
equations :: (Ord a, FreshPickable a)
          => TEContext a
          -> LambdaTerm a
          -> InferenceState (TEContext a, Int, Equations)
equations gamma0 (Var x) =
  case varTypeJudgment x gamma0 of
       Just (_, t) -> do newV <- newTypeVar
                         return (gamma0, newV, singleton (TEVar newV, t))
       Nothing     -> do newV <- newTypeVar
                         return (strongInsert (x, TEVar newV) gamma0,
                                 newV, fromList [])
equations gamma0 (Var x) =
  case varTypeJudgment x gamma0 of
       Just (_, t) -> do newV <- newTypeVar
                         return (gamma0, newV, singleton (TEVar newV, t))
       Nothing     -> do newV <- newTypeVar
                         return (strongInsert (x, TEVar newV) gamma0,
                                 newV, fromList [])