Module Util
This module contains numerous utility functions on strings, lists, arrays, etc.
val on_fst : ('a -> 'b) -> ('a * 'c) -> 'b * 'c
val on_snd : ('a -> 'b) -> ('c * 'a) -> 'c * 'b
val map_pair : ('a -> 'b) -> ('a * 'a) -> 'b * 'b
val fold_fst : ('c -> 'a -> 'c * 'a) -> 'c -> ('a * 'b) -> 'c * ('a * 'b)
val fold_snd : ('c -> 'b -> 'c * 'b) -> 'c -> ('a * 'b) -> 'c * ('a * 'b)
val on_pi1 : ('a -> 'b) -> ('a * 'c * 'd) -> 'b * 'c * 'd
val on_pi2 : ('a -> 'b) -> ('c * 'a * 'd) -> 'c * 'b * 'd
val on_pi3 : ('a -> 'b) -> ('c * 'd * 'a) -> 'c * 'd * 'b
Projections from triplets
Chars.
Empty type
module Empty : sig ... end
Strings.
module String = CString
Lists.
Arrays.
module Array : CArray.ExtS
Sets.
Maps.
Matrices.
Functions.
Delayed computations.
val delayed_force : 'a delayed -> 'a
val try_finally : ('a -> 'b) -> 'a -> ('c -> unit) -> 'c -> 'b
try_finally f x g y
applies the main codef
tox
and returns the result after having applied the finalization codeg
toy
. If the main code raises the exceptionexn
, the finalization code is executed andexn
is raised. If the finalization code itself fails, the exception returned is always the one from the finalization code. Credit X.Leroy, D.Remy.
Enriched exceptions
type iexn
= Exninfo.iexn
val iraise : Exninfo.iexn -> 'a
Misc.
type ('a, 'b) union
= ('a, 'b) CSig.union
=
|
Inl of 'a
|
Inr of 'b
Union type
module Union : sig ... end
type 'a until
= 'a CSig.until
=
|
Stop of 'a
|
Cont of 'a
Used for browsable-until structures.
type ('a, 'b) eq
= ('a, 'b) CSig.eq
=
|
Refl : ('a, 'a) eq
module Compare : sig ... end
Helpers to write comparison functions