Why hard water does not produce lather?

Hard water does not lather with soap because either it contains bicarbonates of calcium and magnesium or it contains sulphates and chlorides of calcium and magnesium.