@@ -36,6 +36,7 @@
3636
3737namespace PureScript {
3838
39+using integer = std::intptr_t;
3940using cstring = const char *;
4041using nullptr_t = std::nullptr_t;
4142
@@ -45,6 +46,9 @@ public:
4546 runtime_error(const char message[]) : std::runtime_error(std::string(message)) {}
4647};
4748
49+const integer INTEGER_MIN = INTPTR_MIN;
50+const integer INTEGER_MAX = INTPTR_MAX;
51+
4852const bool undefined = false;
4953const size_t constructor = 0;
5054
@@ -133,7 +137,7 @@ class any {
133137 private:
134138 union {
135139 mutable thunk t;
136− mutable long i;
140+ mutable integer i;
137141 mutable double d;
138142 mutable char c;
139143 mutable bool b;
@@ -151,7 +155,7 @@ class any {
151155
152156 public:
153157
154− any(const long val) noexcept : type(Type::Integer), i(val) {}
158+ any(const integer val) noexcept : type(Type::Integer), i(val) {}
155159 any(const int val) noexcept : type(Type::Integer), i(val) {}
156160 any(const unsigned int val) noexcept : type(Type::Integer), i(val) {}
157161 any(const double val) noexcept : type(Type::Double), d(val) {}
@@ -273,7 +277,7 @@ class any {
273277 auto operator()(const as_thunk) const -> const any&;
274278 auto operator()() const -> any;
275279
276− operator long() const;
280+ operator integer() const;
277281 operator double() const;
278282 operator bool() const;
279283 operator char() const;
@@ -302,15 +306,15 @@ class any {
302306
303307 #define DEFINE_INT_OPERATOR(op, rty) \
304308 inline friend auto operator op (const any& lhs, int rhs) -> rty { \
305− return (long)lhs op (long)rhs; \
309+ return (integer)lhs op (integer)rhs; \
306310 } \
307311 inline friend auto operator op (int lhs, const any& rhs) -> rty { \
308− return (long)lhs op (long)rhs; \
312+ return (integer)lhs op (integer)rhs; \
309313 }
310314
311315 #define DECLARE_COMPARISON_OPERATOR(op) \
312316 friend auto operator op (const any&, const any&) -> bool; \
313− DEFINE_OPERATOR(op, long, bool) \
317+ DEFINE_OPERATOR(op, integer, bool) \
314318 DEFINE_OPERATOR(op, double, bool) \
315319 DEFINE_OPERATOR(op, char, bool) \
316320 DEFINE_INT_OPERATOR(op, bool) \
@@ -326,39 +330,39 @@ class any {
326330
327331 friend auto operator+(const any&, const any&) -> any;
328332
329− DEFINE_OPERATOR(+, long, long)
333+ DEFINE_OPERATOR(+, integer, integer)
330334 DEFINE_OPERATOR(+, double, double)
331335 DEFINE_OPERATOR(+, char, char)
332− DEFINE_INT_OPERATOR(+, long)
336+ DEFINE_INT_OPERATOR(+, integer)
333337 friend auto operator+(const any& lhs, const char * const rhs) -> std::string;
334338 friend auto operator+(const char * const lhs, const any& rhs) -> std::string;
335339
336340 friend auto operator-(const any&, const any&) -> any;
337341
338− DEFINE_OPERATOR(-, long, long)
342+ DEFINE_OPERATOR(-, integer, integer)
339343 DEFINE_OPERATOR(-, double, double)
340344 DEFINE_OPERATOR(-, char, char)
341− DEFINE_INT_OPERATOR(-, long)
345+ DEFINE_INT_OPERATOR(-, integer)
342346
343347 friend auto operator*(const any&, const any&) -> any;
344348
345− DEFINE_OPERATOR(*, long, long)
349+ DEFINE_OPERATOR(*, integer, integer)
346350 DEFINE_OPERATOR(*, double, double)
347351 DEFINE_OPERATOR(*, char, char)
348− DEFINE_INT_OPERATOR(*, long)
352+ DEFINE_INT_OPERATOR(*, integer)
349353
350354 friend auto operator/(const any&, const any&) -> any;
351355
352− DEFINE_OPERATOR(/, long, long)
356+ DEFINE_OPERATOR(/, integer, integer)
353357 DEFINE_OPERATOR(/, double, double)
354358 DEFINE_OPERATOR(/, char, char)
355− DEFINE_INT_OPERATOR(/, long)
359+ DEFINE_INT_OPERATOR(/, integer)
356360
357361 friend auto operator%(const any&, const any&) -> any;
358362
359− DEFINE_OPERATOR(%, long, long)
363+ DEFINE_OPERATOR(%, integer, integer)
360364 DEFINE_OPERATOR(%, char, char)
361− DEFINE_INT_OPERATOR(%, long)
365+ DEFINE_INT_OPERATOR(%, integer)
362366
363367 friend auto operator-(const any&) -> any; // unary negate
364368};