PurpleKingdomGames / indigo

An FP game engine for Scala.
https://indigoengine.io/
MIT License
648 stars 60 forks source link

Batch: Provide `traverse` operation #741

Open davesmith00000 opened 6 months ago

davesmith00000 commented 6 months ago

We have sequence, I think it's in the syntax package.

The slight snag here is that because we aren't stacking instances of typeclasses, as you would in Cats, what we have is a number of specific hardcoded sequence implementations. So needs a little thought. We could implement a bunch of traverse instances the same way... is that sensible? Could even implment traverse as map.sequence, which is technical the opposite of how you normally do it, i.e. sequence = traverse(identity).