LYAHFGG:
Enum
members are sequentially ordered types — they can be enumerated. The main advantage of theEnum
typeclass is that we can use its types in list ranges. They also have defined successors and predecessors, which you can get with thesucc
andpred
functions.
I could not find Cats’ equivalent for this typeclass.
It’s not an Enum
or range, but non/spire has an interesting data structure called Interval
.
Check out Erik’s Intervals: Unifying Uncertainty, Ranges, and Loops talk from nescala 2015.