This would probably go into the Iterators module, and would work as a "companion" to match.
match
See also: https://discord.com/channels/765519132186640445/1171429149353726062/1180494296995090464