Lime for pH
Dolomite or agricultural lime added to compost piles raises the pH, making the pile more alkaline. Sometimes this is helpful, especially when many acidic elements such as pine needles are used in the pile, and when the compost will later be used to help balance acidic soils. However, the use of lime to raise pH is a matter of debate, since most compost piles will wind up neutral or slightly alkaline once they've finished decomposing.
Lime to Add Calcium
The decomposition process depends on a number of nutrients, including calcium. If the waste matter used in the compost pile was deficient in calcium, and there are no other calcium inputs, then the activity of the decomposition organisms will be lacking. Lime is beneficial for such compost piles, so long as it does not make the pile too alkaline. When compost has finished decomposing, it mellows. When compost mellows, bacteria that turn atmospheric nitrogen into food nitrogen for plants become active. These bacteria need calcium to perform this essential process.
Never use quicklime or slaked lime for compost piles. These are commonly used for making concrete, and their violent chemical reaction to water is highly detrimental to the balance of chemicals and organisms in a compost pile. Adding any kind of lime to hot manure piles (which are not technically compost piles, but are often treated as such) will dispel large quantities of ammonia, speeding the loss of valuable nitrogen to the atmosphere instead of locking it down in solid forms that plants can later use.
Gypsum is a calcifying alternative to lime that does not raise the pH the way lime does. This makes it preferable for compost piles that are in balance or that are already alkaline. Slag, a waste product from smelting industrial iron, is a source not only of calcium but of other nutrients not available in dolomite or agricultural lime. It is pulverized and sold in sacks that are labeled with the chemical analysis of the contents. Check this label carefully before applying to avoid adding too much sulfur -- an acidifying agent -- to the compost pile and, later, to the soil it is used on.