factored out a 'whenEmpty' combinator