With current API, one needs to create an "empty payload" pattern: ```ocaml let p = Ast_pattern.(pstr nil) ``` then register the attribute with a `unit` continuation: ```ocaml let attr = Attribute.declare name context p () ``` And finally, when getting it, turn the `unit option` type into a `bool` type: ```ocaml match Attribute.get attr x with | Some () -> true | None -> false ``` All of this could be simplified with the following API addition: ```ocaml val declare_flag : string -> 'a Context.t -> ('a, unit) t val has_flag : ('a, unit) t -> ?mark_as_seen:bool -> 'a -> bool ``` (reported by @sim642 in https://github.com/ocaml-ppx/ppx_deriving/pull/263#discussion_r924295740)