Module Js_cast

module Js_cast: sig .. end
Safe cast between OCaml values which share the same runtime representation

Different OCaml types might share the same represention in the BuckleScript runtime; while this is a compiler internal knowledge, applications might benefit from having a safe and zero cost conversion between those types.

This modules acts as the single place for such conversion.

If for any reason, the runtime representation changes, those function will be modified accordingly.


val intOfBool : bool -> int
intOfBool b returns 1 for when b is true and 0 when b is false
val floatOfInt : int -> float
floatOfInt i returns the float value of i