Source file unboxed.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
open Base
open Ppxlib

let attribute_name = "unboxed"

let is_unboxed (td : type_declaration) =
  List.exists td.ptype_attributes ~f:(fun { attr_name; _ } ->
    String.( = ) attr_name.txt attribute_name)
;;

let attribute ~builder =
  let open (val builder : Builder.S) in
  attribute ~name:(Located.mk attribute_name) ~payload:(PStr [])
;;