I have a simple module:
module Action = struct
type t =
| Update of int
let should_log _t = true
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.)
Deriving sexp and compare are needed to get [%test_eq] to work. Lots of those details are missing in the RealWorldOCaml test chapter… It shows how to compare int list, but not a custom type.
I agree with this idea.
I want to know more about how to use custom types in