redSel env e@(EVar x) s         = case lookup x (eqns env) of
                                    Just e' | inline e' -> do e' <- alphaConvert e'
                                                              redSel env e' s
                                    _ -> return (ESel e s)
  where inline (ERec _ _)       = True
        inline (EVar _)         = True
        inline _                = False
redSel env e@(EVar x) s         = case lookup x (eqns env) of
                                    Just e' | inline e' -> do e' <- alphaConvert e'
                                                              redSel env e' s
                                    _ -> return (ESel e s)
  where inline (ERec _ _)       = True
        inline (EVar _)         = True
        inline _                = False
redSel env e@(EVar x) s         = case lookup x (eqns env) of
                                    Just e' | inline e' -> do e' <- alphaConvert e'
                                                              redSel env e' s
                                    _ -> return (ESel e s)
  where inline (ERec _ _)       = True
        inline (EVar _)         = True
        inline _                = False