Spin and valley Hall effects for electrons and excitons