cycle package:base-compat

cycle xs returns the infinite repetition of xs:
cycle (1 :| [2,3]) = 1 :| [2,3,1,2,3,...]
cycle ties a finite list into a circular one, or equivalently, the infinite repetition of the original list. It is the identity on infinite lists.
>>> cycle []
*** Exception: Prelude.cycle: empty list

>>> cycle [42]
[42,42,42,42,42,42,42,42,42,42...

>>> cycle [2, 5, 7]
[2,5,7,2,5,7,2,5,7,2,5,7...
A generalization of cycle to an arbitrary Semigroup. May fail to terminate for some values in some semigroups.