diff --git a/CHANGELOG.md b/CHANGELOG.md index 9529bf27aa..80d734f216 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,21 +15,23 @@ #### :boom: Breaking Change - The legacy rescript cli can be called through rewatch via `rewatch legacy`. Arguments to rewatch need to be passed after the subcommand. Argument `--compiler-args` is now a subcommand `compiler-args`. https://github.com/rescript-lang/rescript/pull/7551 -- Rename `Belt` functions ending with `Exn` to end with `OrThrow` https://github.com/rescript-lang/rescript/pull/7581 The following `Exn` functions are now deprecated: - - `Belt.Array.getExn` → `Belt.Array.getOrThrow` - - `Belt.Array.setExn` → `Belt.Array.setOrThrow` - - `Belt.Map.getExn` → `Belt.Map.getOrThrow` - - `Belt.MutableMap.getExn` → `Belt.MutableMap.getOrThrow` - - `Belt.Set.getExn` → `Belt.Set.getOrThrow` - - `Belt.MutableSet.getExn` → `Belt.MutableSet.getOrThrow` - - `Belt.List.getExn` → `Belt.List.getOrThrow` - - `Belt.List.tailExn` → `Belt.List.tailOrThrow` - - `Belt.List.headExn` → `Belt.List.headOrThrow` - - `Belt.MutableQueue.peekExn` → `Belt.MutableQueue.peekOrThrow` - - `Belt.MutableQueue.popExn` → `Belt.MutableQueue.popOrThrow` - - `Belt.Option.getExn` → `Belt.Option.getOrThrow` - - `Belt.Result.getExn` → `Belt.Result.getOrThrow` - - Old functions remain available but are marked as deprecated with guidance to use the new `OrThrow` variants. + +#### :rocket: New Feature + +- Add `OrThrow` aliases for `Belt` functions ending with `Exn`. https://github.com/rescript-lang/rescript/pull/7581, https://github.com/rescript-lang/rescript/pull/7590 The following aliases have been added: + - `Belt.Array.getOrThrow` + - `Belt.Array.setOrThrow` + - `Belt.Map.getOrThrow` + - `Belt.MutableMap.getOrThrow` + - `Belt.Set.getOrThrow` + - `Belt.MutableSet.getOrThrow` + - `Belt.List.getOrThrow` + - `Belt.List.tailOrThrow` + - `Belt.List.headOrThrow` + - `Belt.MutableQueue.peekOrThrow` + - `Belt.MutableQueue.popOrThrow` + - `Belt.Option.getOrThrow` + - `Belt.Result.getOrThrow` #### :bug: Bug fix diff --git a/runtime/Belt_Array.resi b/runtime/Belt_Array.resi index a72d31fa8e..2f35453d70 100644 --- a/runtime/Belt_Array.resi +++ b/runtime/Belt_Array.resi @@ -50,7 +50,6 @@ let get: (t<'a>, int) => option<'a> Raise an exception if `i` is out of range. Otherwise return the value at index `i` in `arr`. */ -@deprecated("Use 'getOrThrow' instead") let getExn: (t<'a>, int) => 'a /** @@ -86,7 +85,6 @@ let set: (t<'a>, int, 'a) => bool /** `setExn(arr, i, x)` raise an exception if `i` is out of range. */ -@deprecated("Use 'setOrThrow' instead") let setExn: (t<'a>, int, 'a) => unit /** diff --git a/runtime/Belt_List.resi b/runtime/Belt_List.resi index c0c5b875b8..9ff36258d2 100644 --- a/runtime/Belt_List.resi +++ b/runtime/Belt_List.resi @@ -77,7 +77,6 @@ switch Belt.List.headExn(list{}) { // Raises an Error } ``` */ -@deprecated("Use `headOrThrow` instead") let headExn: t<'a> => 'a /** @@ -126,7 +125,6 @@ switch Belt.List.tailExn(list{}) { // Raises an Error } ``` */ -@deprecated("Use `tailOrThrow` instead") let tailExn: t<'a> => t<'a> /** @@ -192,7 +190,6 @@ switch abc->Belt.List.getExn(4) { // Raises an Error } ``` */ -@deprecated("Use `getOrThrow` instead") let getExn: (t<'a>, int) => 'a /** diff --git a/runtime/Belt_Map.resi b/runtime/Belt_Map.resi index c6e56e27f8..20d1c5babb 100644 --- a/runtime/Belt_Map.resi +++ b/runtime/Belt_Map.resi @@ -383,7 +383,6 @@ See `Belt.Map.get` raise when `k` not exist */ -@deprecated("Use `getOrThrow` instead") let getExn: (t<'k, 'v, 'id>, 'k) => 'v /** diff --git a/runtime/Belt_MapDict.resi b/runtime/Belt_MapDict.resi index a829bb0526..729061597e 100644 --- a/runtime/Belt_MapDict.resi +++ b/runtime/Belt_MapDict.resi @@ -153,7 +153,6 @@ let getUndefined: (t<'k, 'a, 'id>, 'k, ~cmp: cmp<'k, 'id>) => Js.undefined<'a> let getWithDefault: (t<'k, 'a, 'id>, 'k, 'a, ~cmp: cmp<'k, 'id>) => 'a -@deprecated("Use `getOrThrow` instead") let getExn: (t<'k, 'a, 'id>, 'k, ~cmp: cmp<'k, 'id>) => 'a let getOrThrow: (t<'k, 'a, 'id>, 'k, ~cmp: cmp<'k, 'id>) => 'a diff --git a/runtime/Belt_MapInt.resi b/runtime/Belt_MapInt.resi index 95178e574e..d45ced168e 100644 --- a/runtime/Belt_MapInt.resi +++ b/runtime/Belt_MapInt.resi @@ -114,7 +114,6 @@ let getUndefined: (t<'v>, key) => Js.undefined<'v> let getWithDefault: (t<'v>, key, 'v) => 'v -@deprecated("Use `getOrThrow` instead") let getExn: (t<'v>, key) => 'v let getOrThrow: (t<'v>, key) => 'v diff --git a/runtime/Belt_MapString.resi b/runtime/Belt_MapString.resi index b41f6af754..ed68669798 100644 --- a/runtime/Belt_MapString.resi +++ b/runtime/Belt_MapString.resi @@ -114,7 +114,6 @@ let getUndefined: (t<'v>, key) => Js.undefined<'v> let getWithDefault: (t<'v>, key, 'v) => 'v -@deprecated("Use `getOrThrow` instead") let getExn: (t<'v>, key) => 'v let getOrThrow: (t<'v>, key) => 'v diff --git a/runtime/Belt_MutableMap.resi b/runtime/Belt_MutableMap.resi index c23aeda296..71cd98d1dc 100644 --- a/runtime/Belt_MutableMap.resi +++ b/runtime/Belt_MutableMap.resi @@ -120,7 +120,6 @@ let maxUndefined: t<'k, 'a, _> => Js.undefined<('k, 'a)> let get: (t<'k, 'a, 'id>, 'k) => option<'a> let getUndefined: (t<'k, 'a, 'id>, 'k) => Js.undefined<'a> let getWithDefault: (t<'k, 'a, 'id>, 'k, 'a) => 'a -@deprecated("Use `getOrThrow` instead") let getExn: (t<'k, 'a, 'id>, 'k) => 'a let getOrThrow: (t<'k, 'a, 'id>, 'k) => 'a /** Raise when invariant is not held. */ diff --git a/runtime/Belt_MutableMapInt.resi b/runtime/Belt_MutableMapInt.resi index 14fc79f744..50137e3745 100644 --- a/runtime/Belt_MutableMapInt.resi +++ b/runtime/Belt_MutableMapInt.resi @@ -105,7 +105,6 @@ let maxUndefined: t<'a> => Js.undefined<(key, 'a)> let get: (t<'a>, key) => option<'a> let getUndefined: (t<'a>, key) => Js.undefined<'a> let getWithDefault: (t<'a>, key, 'a) => 'a -@deprecated("Use `getOrThrow` instead") let getExn: (t<'a>, key) => 'a let getOrThrow: (t<'a>, key) => 'a diff --git a/runtime/Belt_MutableMapString.resi b/runtime/Belt_MutableMapString.resi index 0e147c2482..5267799000 100644 --- a/runtime/Belt_MutableMapString.resi +++ b/runtime/Belt_MutableMapString.resi @@ -105,7 +105,6 @@ let maxUndefined: t<'a> => Js.undefined<(key, 'a)> let get: (t<'a>, key) => option<'a> let getUndefined: (t<'a>, key) => Js.undefined<'a> let getWithDefault: (t<'a>, key, 'a) => 'a -@deprecated("Use `getOrThrow` instead") let getExn: (t<'a>, key) => 'a let getOrThrow: (t<'a>, key) => 'a diff --git a/runtime/Belt_MutableQueue.resi b/runtime/Belt_MutableQueue.resi index 6177510c3e..6a6a10be18 100644 --- a/runtime/Belt_MutableQueue.resi +++ b/runtime/Belt_MutableQueue.resi @@ -61,7 +61,6 @@ let peekUndefined: t<'a> => Js.undefined<'a> /** `peekExn(q)` raises an exception if `q` is empty. */ -@deprecated("Use `peekOrThrow` instead") let peekExn: t<'a> => 'a /** @@ -83,7 +82,6 @@ let popUndefined: t<'a> => Js.undefined<'a> /** `popExn(q)` raise an exception if q is empty. */ -@deprecated("Use `popOrThrow` instead") let popExn: t<'a> => 'a /** diff --git a/runtime/Belt_MutableSet.resi b/runtime/Belt_MutableSet.resi index 5ea7d51431..aac4e7de5e 100644 --- a/runtime/Belt_MutableSet.resi +++ b/runtime/Belt_MutableSet.resi @@ -637,7 +637,6 @@ let getUndefined: (t<'value, 'id>, 'value) => Js.undefined<'value> /** Same as `Belt.MutableSet.get` but raise when element does not exist. */ -@deprecated("Use `getOrThrow` instead") let getExn: (t<'value, 'id>, 'value) => 'value /** diff --git a/runtime/Belt_MutableSetInt.resi b/runtime/Belt_MutableSetInt.resi index e946eb3a48..7d5bf2580d 100644 --- a/runtime/Belt_MutableSetInt.resi +++ b/runtime/Belt_MutableSetInt.resi @@ -124,7 +124,6 @@ let maxUndefined: t => Js.undefined let get: (t, value) => option let getUndefined: (t, value) => Js.undefined -@deprecated("Use `getOrThrow` instead") let getExn: (t, value) => value let getOrThrow: (t, value) => value diff --git a/runtime/Belt_MutableSetString.resi b/runtime/Belt_MutableSetString.resi index e7f00376d7..d2fd827e4c 100644 --- a/runtime/Belt_MutableSetString.resi +++ b/runtime/Belt_MutableSetString.resi @@ -124,7 +124,6 @@ let maxUndefined: t => Js.undefined let get: (t, value) => option let getUndefined: (t, value) => Js.undefined -@deprecated("Use `getOrThrow` instead") let getExn: (t, value) => value let getOrThrow: (t, value) => value diff --git a/runtime/Belt_Option.resi b/runtime/Belt_Option.resi index 295631edfc..32a8933ef9 100644 --- a/runtime/Belt_Option.resi +++ b/runtime/Belt_Option.resi @@ -89,7 +89,6 @@ switch Belt.Option.getExn(None) { // Raises an exception } ``` */ -@deprecated("Use `getOrThrow` instead") let getExn: option<'a> => 'a /** diff --git a/runtime/Belt_Result.resi b/runtime/Belt_Result.resi index 936fb895b2..aaa4b1c15b 100644 --- a/runtime/Belt_Result.resi +++ b/runtime/Belt_Result.resi @@ -50,7 +50,6 @@ switch Belt.Result.getExn(Belt.Result.Error("Invalid data")) { // raise a except } ``` */ -@deprecated("Use `getOrThrow` instead") let getExn: t<'a, 'b> => 'a /** diff --git a/runtime/Belt_Set.resi b/runtime/Belt_Set.resi index 5ca7ea5568..72ae9de5fd 100644 --- a/runtime/Belt_Set.resi +++ b/runtime/Belt_Set.resi @@ -697,7 +697,6 @@ let getUndefined: (t<'value, 'id>, 'value) => Js.undefined<'value> /** Same as [get](#get) but raise when element does not exist. */ -@deprecated("Use `getOrThrow` instead") let getExn: (t<'value, 'id>, 'value) => 'value /** diff --git a/runtime/Belt_SetDict.resi b/runtime/Belt_SetDict.resi index f557d212c3..6f652a7b3c 100644 --- a/runtime/Belt_SetDict.resi +++ b/runtime/Belt_SetDict.resi @@ -608,7 +608,6 @@ let getUndefined: (t<'value, 'id>, 'value, ~cmp: cmp<'value, 'id>) => Js.undefin /** Same as [get](#get) but raise when element does not exist. */ -@deprecated("Use `getOrThrow` instead") let getExn: (t<'value, 'id>, 'value, ~cmp: cmp<'value, 'id>) => 'value /** diff --git a/runtime/Belt_SetInt.resi b/runtime/Belt_SetInt.resi index 9273b24bed..e6337a1df8 100644 --- a/runtime/Belt_SetInt.resi +++ b/runtime/Belt_SetInt.resi @@ -152,7 +152,6 @@ let get: (t, value) => option let getUndefined: (t, value) => Js.undefined -@deprecated("Use `getOrThrow` instead") let getExn: (t, value) => value let getOrThrow: (t, value) => value diff --git a/runtime/Belt_SetString.resi b/runtime/Belt_SetString.resi index be6674aee8..06156c9fc6 100644 --- a/runtime/Belt_SetString.resi +++ b/runtime/Belt_SetString.resi @@ -152,7 +152,6 @@ let get: (t, value) => option let getUndefined: (t, value) => Js.undefined -@deprecated("Use `getOrThrow` instead") let getExn: (t, value) => value let getOrThrow: (t, value) => value