package ppx_jsonaf_conv

  1. Overview
  2. Docs
[@@deriving] plugin to generate Jsonaf conversion functions

Install

Dune Dependency

Authors

Maintainers

Sources

v0.17.0.tar.gz
sha256=708e971d5276f7dd5c6d4ec716c3ff722e8a31955c316f52b85c4b287f9d2d28

doc/src/ppx_jsonaf_conv.expander/label_with_name.ml.html

Source file label_with_name.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
open! Base

type t =
  { label : string
  ; name_override : string option
  }

let create ~label ~name_override = { label; name_override }

let of_constructor_declaration (cd : Ppxlib.constructor_declaration) =
  let label = cd.pcd_name.txt in
  let name_override = Ppxlib.Attribute.get Attrs.jsonaf_variant_name cd in
  create ~label ~name_override
;;

let label t = t.label
let name t = Option.value t.name_override ~default:t.label
OCaml

Innovation. Community. Security.