Std.Regular
Regular types models a general concept of value, i.e., something that can be used in way similar to regular int
, string
, char
and other built in types. So that it can be compared, used in maps, sets, hashtables, printer, etc.
Note: this signature is pretty similar to core's Identifiable
, but doesn't require of_string
function, that is usually much harder to implement in comparison with to_string
function. Also, instead of to_string
it requires pp
function that can be implemented much more efficiently and elegantly. From the pp
function the whole plethora of printing functions are derived: str
, pps
, ppo
.
@see <https://ocaml.janestreet.com/ocaml-core/latest/doc/core_kernel/Std/Comparable.mod/S_binable.modt/> Comparable.S_binable
@see <https://ocaml.janestreet.com/ocaml-core/latest/doc/core_kernel/Hashable/S_binable.modt/> Hashable.S_binable