Deriving sexp error

I have a simple module:

module Action = struct
    type t =
        | Increment
        | Update of int
    [@@deriving sexp]

    let should_log _t = true
end

Compilation results in “Error: Unbound value int_of_sexp”. The same code works in utop. Any idea what’s wrong with this syntax?

No syntax error, but you need to open Base to get the sexp converters for the base types. (You can also get them from Sexplib.)

1 Like