Convert `replace` to Cadence.