|
5525 | 5525 | "docstrings": [
|
5526 | 5526 | "`getExn(res)`: when `res` is `Ok(n)`, returns `n` when `res` is `Error(m)`, raise an exception\n\n ```res example\n Result.getExn(Result.Ok(42)) == 42\n\n switch Result.getExn(Error(\"Invalid data\")) {\n | exception Not_found => assert(true)\n | _ => assert(false)\n }\n ```"
|
5527 | 5527 | ],
|
5528 |
| - "signature": "let getExn: result<'a, 'b> => 'a" |
| 5528 | + "signature": "let getExn: result<'a, 'b> => 'a", |
| 5529 | + "deprecated": "Use 'getOrThrow' instead" |
| 5530 | + }, |
| 5531 | + { |
| 5532 | + "id": "Stdlib.Result.getOrThrow", |
| 5533 | + "kind": "value", |
| 5534 | + "name": "getOrThrow", |
| 5535 | + "docstrings": [ |
| 5536 | + "`getOrThrow(res)`: when `res` is `Ok(n)`, returns `n` when `res` is `Error(m)`, raise an exception\n\n ```res example\n Result.getOrThrow(Result.Ok(42)) == 42\n\n switch Result.getOrThrow(Error(\"Invalid data\")) {\n | exception Not_found => assert(true)\n | _ => assert(false)\n }\n ```" |
| 5537 | + ], |
| 5538 | + "signature": "let getOrThrow: result<'a, 'b> => 'a" |
5529 | 5539 | },
|
5530 | 5540 | {
|
5531 | 5541 | "id": "Stdlib.Result.mapOr",
|
|
6271 | 6281 | "docstrings": [
|
6272 | 6282 | "`getExn(opt, ~message=?)` returns `value` if `opt` is `Some(value)`, otherwise raises an exception with the message provided, or a generic message if no message was provided.\n\n```rescript\nOption.getExn(Some(3))->assertEqual(3)\n\nswitch Option.getExn(None) {\n| exception _ => assert(true)\n| _ => assert(false)\n}\n\nswitch Option.getExn(None, ~message=\"was None!\") {\n| exception _ => assert(true) // Raises an Error with the message \"was None!\"\n| _ => assert(false)\n}\n```\n\n## Exceptions\n\n- Raises an error if `opt` is `None`"
|
6273 | 6283 | ],
|
6274 |
| - "signature": "let getExn: (option<'a>, ~message: string=?) => 'a" |
| 6284 | + "signature": "let getExn: (option<'a>, ~message: string=?) => 'a", |
| 6285 | + "deprecated": "Use `getOrThrow` instead" |
| 6286 | + }, |
| 6287 | + { |
| 6288 | + "id": "Stdlib.Option.getOrThrow", |
| 6289 | + "kind": "value", |
| 6290 | + "name": "getOrThrow", |
| 6291 | + "docstrings": [ |
| 6292 | + "`getOrThrow(opt, ~message=?)` returns `value` if `opt` is `Some(value)`, otherwise raises an exception with the message provided, or a generic message if no message was provided.\n\n```rescript\nOption.getOrThrow(Some(3))->assertEqual(3)\n\nswitch Option.getOrThrow(None) {\n| exception _ => assert(true)\n| _ => assert(false)\n}\n\nswitch Option.getOrThrow(None, ~message=\"was None!\") {\n| exception _ => assert(true) // Raises an Error with the message \"was None!\"\n| _ => assert(false)\n}\n```\n\n## Exceptions\n\n- Raises an error if `opt` is `None`" |
| 6293 | + ], |
| 6294 | + "signature": "let getOrThrow: (option<'a>, ~message: string=?) => 'a" |
6275 | 6295 | },
|
6276 | 6296 | {
|
6277 | 6297 | "id": "Stdlib.Option.getUnsafe",
|
|
6754 | 6774 | "docstrings": [
|
6755 | 6775 | "`getExn(value)` raises an exception if `null` or `undefined`, otherwise returns the value.\n\n```rescript\nswitch Nullable.getExn(%raw(\"'Hello'\")) {\n| exception Invalid_argument(_) => assert(false)\n| value => assertEqual(value, \"Hello\")\n}\n\nswitch Nullable.getExn(%raw(\"null\")) {\n| exception Invalid_argument(_) => assert(true)\n| _ => assert(false)\n}\n\nswitch Nullable.getExn(%raw(\"undefined\")) {\n| exception Invalid_argument(_) => assert(true)\n| _ => assert(false)\n}\n```\n\n## Exceptions\n\n- Raises `Invalid_argument` if `value` is `null` or `undefined`"
|
6756 | 6776 | ],
|
6757 |
| - "signature": "let getExn: t<'a> => 'a" |
| 6777 | + "signature": "let getExn: t<'a> => 'a", |
| 6778 | + "deprecated": "Use `getOrThrow` instead" |
| 6779 | + }, |
| 6780 | + { |
| 6781 | + "id": "Stdlib.Nullable.getOrThrow", |
| 6782 | + "kind": "value", |
| 6783 | + "name": "getOrThrow", |
| 6784 | + "docstrings": [ |
| 6785 | + "`getOrThrow(value)` raises an exception if `null` or `undefined`, otherwise returns the value.\n\n```rescript\nswitch Nullable.getOrThrow(%raw(\"'Hello'\")) {\n| exception Invalid_argument(_) => assert(false)\n| value => assertEqual(value, \"Hello\")\n}\n\nswitch Nullable.getOrThrow(%raw(\"null\")) {\n| exception Invalid_argument(_) => assert(true)\n| _ => assert(false)\n}\n\nswitch Nullable.getOrThrow(%raw(\"undefined\")) {\n| exception Invalid_argument(_) => assert(true)\n| _ => assert(false)\n}\n```\n\n## Exceptions\n\n- Raises `Invalid_argument` if `value` is `null` or `undefined`" |
| 6786 | + ], |
| 6787 | + "signature": "let getOrThrow: t<'a> => 'a" |
6758 | 6788 | },
|
6759 | 6789 | {
|
6760 | 6790 | "id": "Stdlib.Nullable.getUnsafe",
|
|
6917 | 6947 | "kind": "value",
|
6918 | 6948 | "name": "getExn",
|
6919 | 6949 | "docstrings": [
|
6920 |
| - "`getExn(value)` raises an exception if `null`, otherwise returns the value.\n\n```rescript\nNull.getExn(Null.make(3))->assertEqual(3)\n\nswitch Null.getExn(%raw(\"'ReScript'\")) {\n| exception Invalid_argument(_) => assert(false)\n| value => assertEqual(value, \"ReScript\")\n}\n\nswitch Null.getExn(%raw(\"null\")) {\n| exception Invalid_argument(_) => assert(true)\n| _ => assert(false)\n}\n```\n\n## Exceptions\n\n- Raises `Invalid_argument` if `value` is `null`," |
| 6950 | + "`getExn(value)` raises an exception if `null`, otherwise returns the value.\n\n```rescript\nNull.getExn(Null.make(3))->assertEqual(3)\n\nswitch Null.getExn(%raw(\"'ReScript'\")) {\n| exception Invalid_argument(_) => assert(false)\n| value => assertEqual(value, \"ReScript\")\n}\n\nswitch Null.getExn(%raw(\"null\")) {\n| exception Invalid_argument(_) => assert(true)\n| _ => assert(false)\n}\n```\n\n## Exceptions\n\n- Raises `Invalid_argument` if `value` is `null`" |
6921 | 6951 | ],
|
6922 |
| - "signature": "let getExn: t<'a> => 'a" |
| 6952 | + "signature": "let getExn: t<'a> => 'a", |
| 6953 | + "deprecated": "Use `getOrThrow` instead" |
| 6954 | + }, |
| 6955 | + { |
| 6956 | + "id": "Stdlib.Null.getOrThrow", |
| 6957 | + "kind": "value", |
| 6958 | + "name": "getOrThrow", |
| 6959 | + "docstrings": [ |
| 6960 | + "`getOrThrow(value)` raises an exception if `null`, otherwise returns the value.\n\n```rescript\nNull.getOrThrow(Null.make(3))->assertEqual(3)\n\nswitch Null.getOrThrow(%raw(\"'ReScript'\")) {\n| exception Invalid_argument(_) => assert(false)\n| value => assertEqual(value, \"ReScript\")\n}\n\nswitch Null.getOrThrow(%raw(\"null\")) {\n| exception Invalid_argument(_) => assert(true)\n| _ => assert(false)\n}\n```\n\n## Exceptions\n\n- Raises `Invalid_argument` if `value` is `null`" |
| 6961 | + ], |
| 6962 | + "signature": "let getOrThrow: t<'a> => 'a" |
6923 | 6963 | },
|
6924 | 6964 | {
|
6925 | 6965 | "id": "Stdlib.Null.getUnsafe",
|
|
7366 | 7406 | "docstrings": [
|
7367 | 7407 | "`headExn(list)` same as [`head`](#head).\n\n## Examples\n\n```rescript\nList.headExn(list{1, 2, 3})->assertEqual(1)\n\nswitch List.headExn(list{}) {\n| exception Not_found => assert(true)\n| _ => assert(false)\n}\n```\n\n## Exceptions\n\n- Raises an Error if list is empty."
|
7368 | 7408 | ],
|
7369 |
| - "signature": "let headExn: list<'a> => 'a" |
| 7409 | + "signature": "let headExn: list<'a> => 'a", |
| 7410 | + "deprecated": "Use `headOrThrow` instead" |
| 7411 | + }, |
| 7412 | + { |
| 7413 | + "id": "Stdlib.List.headOrThrow", |
| 7414 | + "kind": "value", |
| 7415 | + "name": "headOrThrow", |
| 7416 | + "docstrings": [ |
| 7417 | + "`headOrThrow(list)` same as [`head`](#head).\n\n## Examples\n\n```rescript\nList.headOrThrow(list{1, 2, 3})->assertEqual(1)\n\nswitch List.headOrThrow(list{}) {\n| exception Not_found => assert(true)\n| _ => assert(false)\n}\n```\n\n## Exceptions\n\n- Raises an Error if list is empty." |
| 7418 | + ], |
| 7419 | + "signature": "let headOrThrow: list<'a> => 'a" |
7370 | 7420 | },
|
7371 | 7421 | {
|
7372 | 7422 | "id": "Stdlib.List.tail",
|
|
7384 | 7434 | "docstrings": [
|
7385 | 7435 | "`tailExn(list)` same as [`tail`](#tail).\n\n## Examples\n\n```rescript\nList.tailExn(list{1, 2, 3})->assertEqual(list{2, 3})\n\nswitch List.tailExn(list{}) {\n| exception Not_found => assert(true)\n| _ => assert(false)\n}\n```\n\n## Exceptions\n\n- Raises an Error if list is empty."
|
7386 | 7436 | ],
|
7387 |
| - "signature": "let tailExn: list<'a> => list<'a>" |
| 7437 | + "signature": "let tailExn: list<'a> => list<'a>", |
| 7438 | + "deprecated": "Use `tailOrThrow` instead" |
| 7439 | + }, |
| 7440 | + { |
| 7441 | + "id": "Stdlib.List.tailOrThrow", |
| 7442 | + "kind": "value", |
| 7443 | + "name": "tailOrThrow", |
| 7444 | + "docstrings": [ |
| 7445 | + "`tailOrThrow(list)` same as [`tail`](#tail).\n\n## Examples\n\n```rescript\nList.tailOrThrow(list{1, 2, 3})->assertEqual(list{2, 3})\n\nswitch List.tailOrThrow(list{}) {\n| exception Not_found => assert(true)\n| _ => assert(false)\n}\n```\n\n## Exceptions\n\n- Raises an Error if list is empty." |
| 7446 | + ], |
| 7447 | + "signature": "let tailOrThrow: list<'a> => list<'a>" |
7388 | 7448 | },
|
7389 | 7449 | {
|
7390 | 7450 | "id": "Stdlib.List.add",
|
|
7411 | 7471 | "docstrings": [
|
7412 | 7472 | "`getExn(list, index)` same as [`get`](#get).\n\n## Examples\n\n```rescript\nlet abc = list{\"A\", \"B\", \"C\"}\n\nabc\n->List.getExn(1)\n->assertEqual(\"B\")\n\nswitch abc->List.getExn(4) {\n| exception Not_found => assert(true)\n| _ => assert(false)\n}\n```\n\n## Exceptions\n\n- Raises an Error if `index` is larger than the length of list."
|
7413 | 7473 | ],
|
7414 |
| - "signature": "let getExn: (list<'a>, int) => 'a" |
| 7474 | + "signature": "let getExn: (list<'a>, int) => 'a", |
| 7475 | + "deprecated": "Use `getOrThrow` instead" |
| 7476 | + }, |
| 7477 | + { |
| 7478 | + "id": "Stdlib.List.getOrThrow", |
| 7479 | + "kind": "value", |
| 7480 | + "name": "getOrThrow", |
| 7481 | + "docstrings": [ |
| 7482 | + "`getOrThrow(list, index)` same as [`get`](#get).\n\n## Examples\n\n```rescript\nlet abc = list{\"A\", \"B\", \"C\"}\n\nabc\n->List.getOrThrow(1)\n->assertEqual(\"B\")\n\nswitch abc->List.getOrThrow(4) {\n| exception Not_found => assert(true)\n| _ => assert(false)\n}\n```\n\n## Exceptions\n\n- Raises an Error if `index` is larger than the length of list." |
| 7483 | + ], |
| 7484 | + "signature": "let getOrThrow: (list<'a>, int) => 'a" |
7415 | 7485 | },
|
7416 | 7486 | {
|
7417 | 7487 | "id": "Stdlib.List.make",
|
|
0 commit comments