Created
April 13, 2025 12:44
-
-
Save treuks/57715e88c4c56312e29b5d2cc760cb91 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// node_modules/.pnpm/[email protected]/node_modules/rescript/lib/es6/caml_option.js | |
function some(x) { | |
if (x === void 0) { | |
return { | |
BS_PRIVATE_NESTED_SOME_NONE: 0 | |
}; | |
} else if (x !== null && x.BS_PRIVATE_NESTED_SOME_NONE !== void 0) { | |
return { | |
BS_PRIVATE_NESTED_SOME_NONE: x.BS_PRIVATE_NESTED_SOME_NONE + 1 | 0 | |
}; | |
} else { | |
return x; | |
} | |
} | |
function valFromOption(x) { | |
if (!(x !== null && x.BS_PRIVATE_NESTED_SOME_NONE !== void 0)) { | |
return x; | |
} | |
var depth = x.BS_PRIVATE_NESTED_SOME_NONE; | |
if (depth === 0) { | |
return; | |
} else { | |
return { | |
BS_PRIVATE_NESTED_SOME_NONE: depth - 1 | 0 | |
}; | |
} | |
} | |
// node_modules/.pnpm/[email protected]/node_modules/rescript/lib/es6/js_dict.js | |
function get(dict, k) { | |
if (k in dict) { | |
return some(dict[k]); | |
} | |
} | |
// node_modules/.pnpm/@[email protected][email protected]/node_modules/@rescript/core/src/Core__Error.res.mjs | |
function panic(msg) { | |
throw new Error("Panic! " + msg); | |
} | |
// node_modules/.pnpm/@[email protected][email protected]/node_modules/@rescript/core/src/Core__Option.res.mjs | |
function getExn(x, message) { | |
if (x !== void 0) { | |
return valFromOption(x); | |
} else { | |
return panic(message !== void 0 ? message : "Option.getExn called for None value"); | |
} | |
} | |
// src/Main.res.mjs | |
function main(args) { | |
var par = utils.parseParametersFromArguments([{ | |
name: "index", | |
type: "number" | |
}], args); | |
if (par.success !== true) { | |
return par.reply; | |
} | |
var x = get(par.parameters, "index"); | |
var index = getExn(x, "Couldn't get index"); | |
switch (typeof index) { | |
case "number": | |
return "Got index of " + index.toString(); | |
case "string": | |
case "boolean": | |
return "this should never happen"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment