You can use the @@deriving features from ppx_jane in the signature too:
module T : sig
type 'a t =
| Case1
| Case2 of 'a
[@@deriving compare, sexp]
end
The above gets rewritten to something like:
module T : sig
type 'a t =
| Case1
| Case2 of 'a
val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int
val sexp_of_t : ('a -> Sexp.t) -> 'a t -> Sexp.t
val t_of_sexp : (Sexp.t -> 'a) -> Sexp.t -> 'a t
end
I don’t think Comparable can be used with polymorphic types, however. If it could, the rest of the signature might look like: