From 171bd471d49967e722cea6464d4bb4e621b864b1 Mon Sep 17 00:00:00 2001 From: David Sancho Moreno Date: Fri, 2 Aug 2024 16:43:18 +0200 Subject: [PATCH] Remove identity from Option.getUnsafe --- packages/Belt/src/Belt_Option.ml | 3 +-- packages/Belt/src/Belt_Option.mli | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/Belt/src/Belt_Option.ml b/packages/Belt/src/Belt_Option.ml index 49b4aea81..7d7835d9a 100644 --- a/packages/Belt/src/Belt_Option.ml +++ b/packages/Belt/src/Belt_Option.ml @@ -39,5 +39,4 @@ let keepU opt f = let keep opt f = keepU opt (fun x -> f x) let forEachU opt f = match opt with Some x -> f x | None -> () let forEach opt f = forEachU opt (fun x -> f x) - -external getUnsafe : 'a option -> 'a = "%identity" +let getUnsafe = function Some x -> x | None -> assert false diff --git a/packages/Belt/src/Belt_Option.mli b/packages/Belt/src/Belt_Option.mli index bd4fd28af..3705324c8 100644 --- a/packages/Belt/src/Belt_Option.mli +++ b/packages/Belt/src/Belt_Option.mli @@ -44,7 +44,7 @@ val getExn : 'a option -> 'a ]} *) -external getUnsafe : 'a option -> 'a = "%identity" +val getUnsafe : 'a option -> 'a (** [getUnsafe x] returns x This is an unsafe operation, it assumes x is neither not None or (Some (None .. ))