There are a number of predefined interfaces in Hack. This post is going to give you an overview about the interfaces that are a subtype of Traversable.
This is an abstract interface. Each an every class that implements this interface may be use with foreach()
This is an abstract interface. When implementing this you may use your object with a foreach with keyes. Like foreach($c as $k => $v)
This interface requires you to have a getIterator() function that will return an external iterator.
Interface to create an iterable object that will work with foreach()
Interface to create an iterable object that will work with foreach() with keyes. Like foreach($c as $k => $v).
Allows you to use the bracket syntax.
Interface for external iterators or objects that can be iterated themselves internally.
Same as Iterator but with keys.
This object is return from generators. The manual has an excellent example of how to use Continuation.