Enum instance for Month is misleading


unless I am mistaken, toEnum 1 :: Month is not Jan, but Feb.

Needless to say I fell into this trap. Now, I am not sure if it is too late to change this with a custom instance Enum Month. If it is, I propose a note about this in the documentation.


1 Like

Hi @Alexander_Bernauer, I recommend viewing Enum not as a way to convert types from and to Ints but instead to view it purely as a way to enumerate values with the integer conversion being an implementation detail. At that point, it doesn’t matter whether toEnum returns 0, 23 or 42. If you need a specific integer conversion, you are better off implementing your own.

That said, I fully agree, that are docs are lacking here and we’ll work on clarifying this.