Enum instance for Month is misleading
- Alexander_BernauerOP 1
Hi,
unless I am mistaken,
toEnum 1 :: Monthis notJan, butFeb.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.Regards,
Alex - cocreature 4
Hi @Alexander_Bernauer, I recommend viewing
Enumnot as a way to convert types from and toInts 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 whethertoEnumreturns 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.