mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-07 11:45:31 -05:00
parse: deprecate try_, rename new function try_opt
This commit is contained in:
parent
0ec40c2331
commit
171b4ddcd9
2 changed files with 12 additions and 2 deletions
|
|
@ -457,7 +457,9 @@ let fix f =
|
||||||
and f_self = lazy (f self) in
|
and f_self = lazy (f self) in
|
||||||
self
|
self
|
||||||
|
|
||||||
let try_ p : _ t = {
|
let try_ p = p
|
||||||
|
|
||||||
|
let try_opt p : _ t = {
|
||||||
run=fun st ~ok ~err:_ ->
|
run=fun st ~ok ~err:_ ->
|
||||||
p.run st
|
p.run st
|
||||||
~ok:(fun st x -> ok st (Some x))
|
~ok:(fun st x -> ok st (Some x))
|
||||||
|
|
|
||||||
|
|
@ -229,7 +229,15 @@ val optional : _ t -> unit t
|
||||||
succeeded or failed. Cannot fail.
|
succeeded or failed. Cannot fail.
|
||||||
@since NEXT_RELEASE *)
|
@since NEXT_RELEASE *)
|
||||||
|
|
||||||
val try_ : 'a t -> 'a option t
|
val try_ : 'a t -> 'a t
|
||||||
|
(** [try_ p] is just like [p] (it used to play a role in backtracking
|
||||||
|
semantics but no more).
|
||||||
|
|
||||||
|
@deprecated since NEXT_RELEASE it can just be removed. See {!try_opt} if you want
|
||||||
|
to detect failure. *)
|
||||||
|
[@@deprecated "plays no role anymore"]
|
||||||
|
|
||||||
|
val try_opt : 'a t -> 'a option t
|
||||||
(** [try_ p] tries to parse using [p], and return [Some x] if [p]
|
(** [try_ p] tries to parse using [p], and return [Some x] if [p]
|
||||||
succeeded with [x]. Otherwise it returns [None]. This cannot fail.
|
succeeded with [x]. Otherwise it returns [None]. This cannot fail.
|
||||||
@since NEXT_RELEASE *)
|
@since NEXT_RELEASE *)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue