AFAIK all unsafeFromArray does is call asInstanceOf, and while I do like those aliases to avoid calling the cats myself, if you know what you are doing, then just cast.
If you please, make your own function to preserve some kind of typesafety.
Oh, right, it can do that because it is an opaque and it is in the visible scope. But, again, doing asInstanceOf is fine.
I do get your point about it being better in the object itself, but making changes to the stdlib requires some effort, and this opens the door to how many nested levels it should support? Only 2, 3, 5, 10?
Thinking about it, since in essence, no matter the level of nesting, this can be just an asInstanceOf. I wonder if a match type can be used to support arbitrary nesting; if so, that addition to the stdlib would be more welcome IMHO.
Maybe adding mapConserve to Array would be enough?
The implementation would have to guarantee that it would only allocate a new array on a mismatch (and not upfront)… Although that’s still slower than just casting.