blob: 282e96e3238a6d09bd01689f67b025d6df530d5f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
(* TEST
setup-ocamlc.byte-build-env;
flags = "-dlambda -dno-unique-ids";
ocamlc.byte;
{
flat-float-array;
compiler_reference = "${test_source_directory}/module_coercion.compilers.flat.reference";
check-ocamlc.byte-output;
}{
no-flat-float-array;
compiler_reference = "${test_source_directory}/module_coercion.compilers.no-flat.reference";
check-ocamlc.byte-output;
}
*)
module M = struct
external len : 'a array -> int = "%array_length"
external safe_get : 'a array -> int -> 'a = "%array_safe_get"
external unsafe_get : 'a array -> int -> 'a = "%array_unsafe_get"
external safe_set : 'a array -> int -> 'a -> unit = "%array_safe_set"
external unsafe_set : 'a array -> int -> 'a -> unit = "%array_unsafe_set"
external cmp : 'a -> 'a -> int = "%compare";;
external eq : 'a -> 'a -> bool = "%equal";;
external ne : 'a -> 'a -> bool = "%notequal";;
external lt : 'a -> 'a -> bool = "%lessthan";;
external gt : 'a -> 'a -> bool = "%greaterthan";;
external le : 'a -> 'a -> bool = "%lessequal";;
external ge : 'a -> 'a -> bool = "%greaterequal";;
end;;
module type T = sig
type t
val len : t array -> int
val safe_get : t array -> int -> t
val unsafe_get : t array -> int -> t
val safe_set : t array -> int -> t -> unit
val unsafe_set : t array -> int -> t -> unit
val cmp : t -> t -> int
val eq : t -> t -> bool
val ne : t -> t -> bool
val lt : t -> t -> bool
val gt : t -> t -> bool
val le : t -> t -> bool
val ge : t -> t -> bool
end;;
module M_int : T with type t := int = M;;
module M_float : T with type t := float = M;;
module M_string : T with type t := string = M;;
module M_int32 : T with type t := int32 = M;;
module M_int64 : T with type t := int64 = M;;
module M_nativeint : T with type t := nativeint = M;;
|