Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
This module defines classes which are shared by the encoding and decoding modules.
Synopsis
- class ProtoEnum a where
- toProtoEnumMay :: Int32 -> Maybe a
- fromProtoEnum :: a -> Int32
Documentation
class ProtoEnum a where Source #
Similar to Enum
, but allows gaps in the sequence of numeric codes,
and uses Int32
in order to match the proto3 specification.
Absent gaps, you can use an automatic derivation of Bounded
and Enum
,
then use the default implementations for all methods of this class. But
if gaps are involved, then you must instantiate this class directly and
supply the specific numeric codes desired for each constructor.
Nothing