Ppx_polymarket_enumSourcePPX deriver for enum types with string conversion.
Generates the full enum interface inline without any runtime dependencies.
Usage:
type t = Foo | Bar | Baz [@@deriving enum]Generates UPPERCASE strings by default (Foo -> "FOO"). Case-insensitive parsing is enabled by default.
For custom string mappings, use @value:
type t = Min_1 [@value "1m"] | Hour_1 [@value "1h"] [@@deriving enum]Generated functions:
Extract custom value from @value "..." attribute on a constructor
Convert constructor name to UPPERCASE string (default convention)
val generate_to_string :
loc:Ppxlib__.Import.location ->
(string * Ppxlib.attribute list * 'a) list ->
Ppxlib_ast.Ast.expressionGenerate the to_string function as a pattern match
val generate_of_string_opt :
loc:Ppxlib.location ->
(string * Ppxlib.attribute list * 'a) list ->
Ppxlib_ast.Ast.expressionGenerate the of_string_opt function with case-insensitive matching
val generate_impl :
ctxt:Ppxlib.Expansion_context.Deriver.t ->
('a * Ppxlib.type_declaration list) ->
Ppxlib_ast.Ast.structure_item listMain structure generator for the deriver
val impl_generator :
(Ppxlib_ast.Ast.structure_item list,
Ppxlib__.Import.rec_flag * Ppxlib.type_declaration list)
Ppxlib__Deriving.Generator.tRegister the deriver