inferExpr :: TypeEnv -> Expr -> Either TypeError Scheme
inferExpr env ex =
  case runInfer env (infer ex) of
    Left err -> Left err
    Right (ty, cs) ->
      case runSolve cs of
        Left err    -> Left err
        Right subst -> Right $ closeOver $ apply subst ty
inferExpr :: TypeEnv -> Expr -> Either TypeError Scheme
inferExpr env ex =
  case runInfer env (infer ex) of
    Left err -> Left err
    Right (ty, cs) ->
      case runSolve cs of
        Left err    -> Left err
        Right subst -> Right $ closeOver $ apply subst ty
inferExpr env ex =
  case runInfer env (infer ex) of
    Left err -> Left err
    Right (ty, cs) ->
      case runSolve cs of
        Left err    -> Left err
        Right subst -> Right $ closeOver $ apply subst ty