I saw a garden yesterday that the guy has covered with old hay.

Is that just for it to turn into compost ?or does it serve another purpose