package polymarket

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module Ppx_polymarket_enumSource

PPX 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:

  • to_string : t -> string
  • of_string : string -> t
  • of_string_opt : string -> t option
  • t_of_yojson : Yojson.Safe.t -> t
  • yojson_of_t : t -> Yojson.Safe.t
  • pp : Format.formatter -> t -> unit
  • equal : t -> t -> bool
Sourceval get_custom_value : Ppxlib.attribute list -> string option

Extract custom value from @value "..." attribute on a constructor

Sourceval constructor_to_uppercase : string -> string

Convert constructor name to UPPERCASE string (default convention)

Sourceval generate_to_string : loc:Ppxlib__.Import.location -> (string * Ppxlib.attribute list * 'a) list -> Ppxlib_ast.Ast.expression

Generate the to_string function as a pattern match

Sourceval generate_of_string_opt : loc:Ppxlib.location -> (string * Ppxlib.attribute list * 'a) list -> Ppxlib_ast.Ast.expression

Generate the of_string_opt function with case-insensitive matching

Sourceval generate_impl : ctxt:Ppxlib.Expansion_context.Deriver.t -> ('a * Ppxlib.type_declaration list) -> Ppxlib_ast.Ast.structure_item list

Main structure generator for the deriver

Sourceval impl_generator : (Ppxlib_ast.Ast.structure_item list, Ppxlib__.Import.rec_flag * Ppxlib.type_declaration list) Ppxlib__Deriving.Generator.t

Register the deriver

Sourceval my_deriver : Ppxlib.Deriving.t