As others said, having Core open causes this behavior. But if you really want unsafe access, you can write an Array module that has its own get
function that returns 'a
instead of option<'a>
.
// with Core open
let xs = [1, 2, 3]
let m = xs[1]
// ^ option<int>
module Array = {
@get_index external get: (array<'a>, int) => 'a = ""
}
let n = xs[1]
// ^ int