redExp env e@(EVar x)           = case lookup x (eqns env) of
                                      Just e' | inline e' -> alphaConvert e'
                                      _ -> return e
  where inline (EVar _)         = True
        inline (ECon _)         = True
        inline (ELit _)         = True
        inline (ELam _ _)       = True
        inline _                = isGenerated x
redExp env e@(EVar x)           = case lookup x (eqns env) of
                                      Just e' | inline e' -> alphaConvert e'
                                      _ -> return e
  where inline (EVar _)         = True
        inline (ECon _)         = True
        inline (ELit _)         = True
        inline (ELam _ _)       = True
        inline _                = isGenerated x
redExp env e@(EVar x)           = case lookup x (eqns env) of
                                      Just e' | inline e' -> alphaConvert e'
                                      _ -> return e
  where inline (EVar _)         = True
        inline (ECon _)         = True
        inline (ELit _)         = True
        inline (ELam _ _)       = True
        inline _                = isGenerated x