We derive the mass function of spiral galaxy haloes using the luminosity function and the inferred variation in mass-to-light ratio with spiral galaxy luminosity. We show that the resulting mass function is consistent with hierarchical clustering models of galaxy formation. This contrasts with previous results based on the assumption of a constant mass-to-light ratio for all spirals, which predict too many low-luminosity galaxies. By reversing the argument, we show that, if spirals form through hierarchical clustering, then the observed luminosity function requires an increase in the dark matter fraction with decreasing luminosity.