The present invention relates to macrocyclic compounds of formula (I): whereinW, n, m, R R, R, R, R,R M, Z and ring B are defined herein, and pharmaceutically acceptablesalts thereof, pharmaceutical co mposit ions comprising them, and their usefor the treatment or prevention of infection by hepatitis C virus.