toEnum -package:ghc

Convert from an Int.
toEnum, same as in the Enum class, except it takes an SInteger
Convert from an Int.
Convert index to value
Returns Nothing if given Int outside range.
>>> safeToEnum @Bool 0
Just False

>>> safeToEnum @Bool 1
Just True

>>> safeToEnum @Bool 2
Nothing

>>> safeToEnum @Bool (-1)
Nothing
Convert the given Int to an enum value. Returns Nothing if no corresponding value was defined in the .proto file.
Safe version of toEnum