The List() functor can be confusing at first. It's extremely lazy, unlike Python's built-in list type. When we evaluate the built-in list(range(10)) method, the list() function will evaluate the range() object to create a list with 10 items. The PyMonad List() functor, however, is too lazy to even do this evaluation.
Here's the comparison:
>>> list(range(10)) [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] >>> List(range(10)) [range(0, 10)]
The List() functor did not evaluate the range() object, it just preserved it without being evaluated. The pymonad.List() function is useful to collect functions without evaluating them.
The use of range() here can be a little confusing. The Python 3 range() object is also lazy. In this case, ...