From 2d1ba8d9259248d4d1dc62ba34d7d96ab88879a6 Mon Sep 17 00:00:00 2001 From: Fardale Date: Sat, 18 Jan 2020 15:57:55 +0100 Subject: [PATCH] feat(CCInt): add of_string_exn --- src/core/CCInt.ml | 2 ++ src/core/CCInt.mli | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/src/core/CCInt.ml b/src/core/CCInt.ml index b081561d..bd8b7140 100644 --- a/src/core/CCInt.ml +++ b/src/core/CCInt.ml @@ -209,6 +209,8 @@ let of_string s = (Some 42) (of_string "42") *) +let of_string_exn = Stdlib.int_of_string + type output = char -> unit (* abstract printer *) diff --git a/src/core/CCInt.mli b/src/core/CCInt.mli index 1e23ce21..0a515611 100644 --- a/src/core/CCInt.mli +++ b/src/core/CCInt.mli @@ -53,6 +53,11 @@ val to_string : t -> string val of_string : string -> t option (** @since 0.13 *) +val of_string_exn : string -> t +(** Alias to {!int_of_string}. + @raise Failure in case of failure. + @since NEXT_RELEASE *) + val pp_binary : t printer (** Print as "0b00101010". @since 0.20 *)