forked from rescript-lang/rescript
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexn_error_pattern.js
46 lines (40 loc) · 1.25 KB
/
exn_error_pattern.js
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
'use strict';
var Caml_exceptions = require("../../lib/js/caml_exceptions.js");
var Caml_builtin_exceptions = require("../../lib/js/caml_builtin_exceptions.js");
function f(match) {
if (Caml_exceptions.isCamlExceptionOrOpenVariant(match)) {
if (match === Caml_builtin_exceptions.not_found) {
return [0];
} else if (match[0] === Caml_builtin_exceptions.invalid_argument || match === Caml_builtin_exceptions.stack_overflow) {
return [1];
} else if (match[0] === Caml_builtin_exceptions.sys_error) {
return [2];
} else {
return /* None */0;
}
} else {
return /* None */0;
}
}
var A = Caml_exceptions.create("Exn_error_pattern.A");
var B = Caml_exceptions.create("Exn_error_pattern.B");
function g(match) {
if (Caml_exceptions.isCamlExceptionOrOpenVariant(match)) {
if (match === Caml_builtin_exceptions.not_found || match[0] === Caml_builtin_exceptions.invalid_argument) {
return [0];
} else if (match[0] === Caml_builtin_exceptions.sys_error) {
return [2];
} else if (match[0] === A || match[0] === B) {
return [match[1]];
} else {
return /* None */0;
}
} else {
return /* None */0;
}
}
exports.f = f;
exports.A = A;
exports.B = B;
exports.g = g;
/* No side effect */