package polymarket

  1. Overview
  2. Docs
OCaml client library for the Polymarket prediction market API

Install

dune-project
 Dependency

Authors

Maintainers

Sources

0.2.0.tar.gz
md5=4eb4c5d2f63ff081c9713d90be5a51b2
sha512=0e3de0c9b40683e09ab8f9f966a44784ef1b9b482c3eefef84104a7e8042c92f1d79893ee9588b24fa3d0decaed7f365509f4d1c23c66ce8328efb64e721f276

doc/ppx_polymarket_enum/Ppx_polymarket_enum/index.html

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