The evolution of HCG 31: Optical and high-resolution HI study.