Module Gist.Scalar

Operating on scalar types.

type 'a t = 'a scalar

The type for scalars of type 'a.

val meta : 'a scalar -> 'a Meta.t

meta s is the meta of s.

val zero : 'a scalar -> 'a

zero s is a zero value for s.

val ocaml_type_name : 'a scalar -> string

ocaml_type_name s is the ocaml type name of the scalar of s.

val equal : 'a scalar -> 'a -> 'a -> bool

equal s v0 v1 is true iff v0 and v1 are the same value as per the Stdlib's corresponding M.equal function.

val compare : 'a scalar -> 'a -> 'a -> int

equal s v0 v1 is true iff v0 and v1 are the same value as per the Stdlib's corresponding M.compare function.

val to_string : 'a scalar -> 'a -> string

to_string s v converts v to a string. This uses the Stdlib's corresponding M.to_string functions, except for:

  • char, UTF-8 compatible characters are output as is, otherwise hex escaped. TODO. What about simply interpreting the byte as a Unicode scalar value ? (that'd give a latin1 interpretation I think).
  • Uchar.t, the UTF-8 encoding of the character is returned