redApp env e@(EVar x) es        = case lookup x (eqns env) of
                                       Just e' | inline e' -> do e' <- alphaConvert e'; redApp env e' es
                                       _ -> return (EAp e es)
  where inline (ELam _ _)       = True
        inline (EVar _)         = True
        inline _                = False
redApp env e@(EVar x) es        = case lookup x (eqns env) of
                                       Just e' | inline e' -> do e' <- alphaConvert e'; redApp env e' es
                                       _ -> return (EAp e es)
  where inline (ELam _ _)       = True
        inline (EVar _)         = True
        inline _                = False
redApp env e@(EVar x) es        = case lookup x (eqns env) of
                                       Just e' | inline e' -> do e' <- alphaConvert e'; redApp env e' es
                                       _ -> return (EAp e es)
  where inline (ELam _ _)       = True
        inline (EVar _)         = True
        inline _                = False