Heavy-flavour spectra in high-energy nucleus–nucleus collisions