More idiomatic implementation of 'vectorOf'

Note that `replicateM` is present in `base` since August 2002 (https://github.com/ghc/ghc/blob/e2e8a57360669da00a8bee6491b708896fbe168e/libraries/base/Control/Monad.hs).