I've been looking at this feature request for some time now and I wonder whether this is something the Kotlin designers would like to have in the stdlib as well. If so, would you be open for a PR or if not, perhaps a KEEP for it?
https://youtrack.jetbrains.com/issue/KT-8220#tab=Comments