3 ms·
Not just arguably--that's exactly what they are. E.g., in Haskell: data Suit = Spades | Hearts | Clubs | Diamonds
by tikhonj 13y ago
Not just arguably--that's exactly what they are. E.g., in Haskell:
data Suit = Spades
| Hearts
| Clubs
| Diamonds deriving (Show, Eq, Bounded, Enum)
this creates a type that acts exactly like an enum. With the added benefit of having a well-defined string representation and maxBound/minBound constants for free.