shiftR package:xmonad-contrib

Sends the focused window to the specified workspace, refocusing the last focused window if the predicate holds on the current window. Note that the native version of this, windows . W.shift, has a nice property that this does not: shifting a window to another workspace then shifting it back preserves its place in the stack. Can be used in a keybinding like e.g.
windows =<< shiftRLWhen refocusingIsActive "3"
or
(windows <=< shiftRLWhen refocusingIsActive) "3"
where <=< is imported from Control.Monad.