Commit | Line | Data |
---|---|---|
7f918cf1 CE |
1 | (* Copyright (C) 1999-2005, 2008 Henry Cejtin, Matthew Fluet, Suresh |
2 | * Jagannathan, and Stephen Weeks. | |
3 | * Copyright (C) 1997-2000 NEC Research Institute. | |
4 | * | |
5 | * MLton is released under a BSD-style license. | |
6 | * See the file MLton-LICENSE for details. | |
7 | *) | |
8 | ||
9 | _overload ~ : ('a -> 'a) | |
10 | as Int.~ | |
11 | and IntInf.~ | |
12 | and Real.~ | |
13 | ||
14 | _overload + : ('a * 'a -> 'a) | |
15 | as Int.+ | |
16 | and IntInf.+ | |
17 | and Word.+ | |
18 | and Word8.+ | |
19 | and Real.+ | |
20 | ||
21 | _overload - : ('a * 'a -> 'a) | |
22 | as Int.- | |
23 | and IntInf.- | |
24 | and Word.- | |
25 | and Word8.- | |
26 | and Real.- | |
27 | ||
28 | _overload * : ('a * 'a -> 'a) | |
29 | as Int.* | |
30 | and IntInf.* | |
31 | and Word.* | |
32 | and Word8.* | |
33 | and Real.* | |
34 | ||
35 | (* Can't use the following overload, because then | |
36 | * fun f (x, y) = x + y / y | |
37 | * fails to type check. The problem is that because + and / are not constrained, | |
38 | * the type checker chooses the default type for +, int * int -> int. It is | |
39 | * then screwed because it can't chose that type for /. The problem happens | |
40 | * when there are overloaded variables that have some compatible type (in this | |
41 | * case real) but one of whose default types (int) is not a valid instance | |
42 | * of the other. | |
43 | *) | |
44 | (* | |
45 | * _overload / : ('a * 'a -> 'a) | |
46 | * as Real./ | |
47 | *) | |
48 | val op / = Real./ | |
49 | ||
50 | _overload div: ('a * 'a -> 'a) | |
51 | as Int.div | |
52 | and IntInf.div | |
53 | and Word.div | |
54 | and Word8.div | |
55 | ||
56 | _overload mod: ('a * 'a -> 'a) | |
57 | as Int.mod | |
58 | and IntInf.mod | |
59 | and Word.mod | |
60 | and Word8.mod | |
61 | ||
62 | _overload < : ('a * 'a -> bool) | |
63 | as Int.< | |
64 | and IntInf.< | |
65 | and Word.< | |
66 | and Word8.< | |
67 | and Real.< | |
68 | and Char.< | |
69 | and String.< | |
70 | ||
71 | _overload <= : ('a * 'a -> bool) | |
72 | as Int.<= | |
73 | and IntInf.<= | |
74 | and Word.<= | |
75 | and Word8.<= | |
76 | and Real.<= | |
77 | and Char.<= | |
78 | and String.<= | |
79 | ||
80 | _overload > : ('a * 'a -> bool) | |
81 | as Int.> | |
82 | and IntInf.> | |
83 | and Word.> | |
84 | and Word8.> | |
85 | and Real.> | |
86 | and Char.> | |
87 | and String.> | |
88 | ||
89 | _overload >= : ('a * 'a -> bool) | |
90 | as Int.>= | |
91 | and IntInf.>= | |
92 | and Word.>= | |
93 | and Word8.>= | |
94 | and Real.>= | |
95 | and Char.>= | |
96 | and String.>= | |
97 | ||
98 | _overload abs: ('a -> 'a) | |
99 | as Int.abs | |
100 | and IntInf.abs | |
101 | and Real.abs |