You could also think of it from the perspective of Fermat's Principle. The bent path is *slightly* longer, but the light travels *slightly* faster. Apparently, the combination of the two effects results in the bent path takes slightly less time overall, so the light travels that way rather than "straight" from the source to your eyes.