Production of muons from heavy-flavour hadron decays in p–Pb collisions at sNN=5.02 TeV