@@deriving sexp w/ Map.t


module Min_Fail = struct
  type t = (int, int, Int.comparator_witness) Map.t
    [@@deriving sexp] 
  ;;
end


error:

16 |   type t = (int, int, Int.comparator_witness) Map.t
                                                   ^^^^^
Error: Unbound value Map.t_of_sexp
Hint: Did you mean m__t_of_sexp?

I am a little confused by what I am doing wrong. All what I’m trying to do is a minimal example of Map.t w/ deriving sexp.

You need to use the applicative functor api for Map to be able to use it with deriving style function.

module Min_Fail = struct
  type t = int Map.M(Int).t
    [@@deriving sexp] 
  ;;
end

Relevant portions from base’s documentation: https://github.com/janestreet/base/blob/57dc5f74a0a6a0d014808603fefac221ffa439c1/src/map_intf.ml#L1837-L1864

1 Like

Related question:

Is there a reason to prefer

Map.M(X).t

vs

X.Map.t