module Js_types:sig
..end
type
symbol
type
obj_val
type
undefined_val
undefined
type
null_val
null
type
function_val
type '_
t =
| |
Undefined | : | undefined_val t |
| |
Null | : | null_val t |
| |
Boolean | : | Js.boolean t |
| |
Number | : | float t |
| |
String | : | string t |
| |
Function | : | function_val t |
| |
Object | : | obj_val t |
| |
Symbol | : | symbol t |
val reify_type : 'a -> 'b t * 'b
'b t
is GADT, the type system will reify its type automatically,match reify_type "3" with | String, v -> v ^ " this type safe control flow analysis will infer v as string" | _ -> assert false
val test : 'a -> 'b t -> bool
test "x" String = true
type
tagged_t =
| |
JSFalse |
||
| |
JSTrue |
||
| |
JSNull |
||
| |
JSUndefined |
||
| |
JSNumber | of | float |
| |
JSString | of | string |
| |
JSFunction | of | function_val |
| |
JSObject | of | obj_val |
| |
JSSymbol | of | symbol |
val classify : 'a -> tagged_t