You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
131 lines
3.4 KiB
131 lines
3.4 KiB
7 years ago
|
(*
|
||
6 years ago
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
||
7 years ago
|
*
|
||
|
* This source code is licensed under the MIT license found in the
|
||
|
* LICENSE file in the root directory of this source tree.
|
||
|
*)
|
||
7 years ago
|
|
||
5 years ago
|
(** Global namespace intended to be opened in each source file *)
|
||
7 years ago
|
|
||
5 years ago
|
include module type of NS0
|
||
6 years ago
|
|
||
|
(** Function combinators *)
|
||
|
|
||
5 years ago
|
val ( let@ ) : ('a -> 'b) -> 'a -> 'b
|
||
|
(** [let@ x = e in b] is equivalent to [e @@ fun x -> b], that is,
|
||
|
[e (fun x -> b)] *)
|
||
|
|
||
7 years ago
|
val ( >> ) : ('a -> 'b) -> ('b -> 'c) -> 'a -> 'c
|
||
5 years ago
|
(** Composition of functions: [(f >> g) x] is exactly equivalent to
|
||
|
[g (f (x))]. Left associative. *)
|
||
7 years ago
|
|
||
5 years ago
|
val ( << ) : ('b -> 'c) -> ('a -> 'b) -> 'a -> 'c
|
||
|
(** Reverse composition of functions: [(g << f) x] is exactly equivalent to
|
||
|
[g (f (x))]. Left associative. *)
|
||
|
|
||
7 years ago
|
val ( $ ) : ('a -> unit) -> ('a -> 'b) -> 'a -> 'b
|
||
|
(** Sequential composition of functions: [(f $ g) x] is exactly equivalent
|
||
|
to [(f x) ; (g x)]. Left associative. *)
|
||
|
|
||
|
val ( $> ) : 'a -> ('a -> unit) -> 'a
|
||
5 years ago
|
(** Reverse apply and ignore function: [x $> f] is exactly equivalent to
|
||
|
[f x ; x]. Left associative. *)
|
||
7 years ago
|
|
||
|
val ( <$ ) : ('a -> unit) -> 'a -> 'a
|
||
5 years ago
|
(** Apply and ignore function: [f <$ x] is exactly equivalent to [f x ; x].
|
||
|
Left associative. *)
|
||
7 years ago
|
|
||
6 years ago
|
(** Failures *)
|
||
7 years ago
|
|
||
|
exception Unimplemented of string
|
||
|
|
||
5 years ago
|
val fail : ('a, unit -> _) fmt -> 'a
|
||
|
(** Emit a message at the current indentation level, and raise a [Failure]
|
||
|
exception indicating a fatal error. *)
|
||
7 years ago
|
|
||
6 years ago
|
val todo : ('a, unit -> _) fmt -> 'a
|
||
7 years ago
|
(** Raise an [Unimplemented] exception indicating that an input is valid but
|
||
|
not handled by the current implementation. *)
|
||
|
|
||
5 years ago
|
val warn : ('a, unit -> unit) fmt -> 'a
|
||
|
(** Issue a warning for a survivable problem. *)
|
||
|
|
||
|
(** Assertions *)
|
||
|
|
||
6 years ago
|
val assertf : bool -> ('a, unit -> unit) fmt -> 'a
|
||
7 years ago
|
(** Raise an [Failure] exception if the bool argument is false, indicating
|
||
|
that the expected condition was not satisfied. *)
|
||
|
|
||
6 years ago
|
val checkf : bool -> ('a, unit -> bool) fmt -> 'a
|
||
7 years ago
|
(** As [assertf] but returns the argument bool. *)
|
||
|
|
||
6 years ago
|
val check : ('a -> unit) -> 'a -> 'a
|
||
|
(** Assert that function does not raise on argument, and return argument. *)
|
||
|
|
||
|
val violates : ('a -> unit) -> 'a -> _
|
||
|
(** Assert that function raises on argument. *)
|
||
|
|
||
|
(** Extensions *)
|
||
|
|
||
5 years ago
|
module Invariant : module type of Core.Invariant
|
||
5 years ago
|
|
||
5 years ago
|
(** Containers *)
|
||
5 years ago
|
|
||
5 years ago
|
module Option = Option
|
||
|
include module type of Option.Monad_infix
|
||
|
include module type of Option.Monad_syntax
|
||
|
module List = List
|
||
5 years ago
|
|
||
5 years ago
|
module Array : sig
|
||
|
include module type of Array
|
||
5 years ago
|
|
||
5 years ago
|
val pp : (unit, unit) fmt -> 'a pp -> 'a array pp
|
||
5 years ago
|
|
||
|
val fold_map_inplace :
|
||
|
'a array -> init:'s -> f:('s -> 'a -> 's * 'a) -> 's
|
||
5 years ago
|
end
|
||
5 years ago
|
|
||
5 years ago
|
module IArray = IArray
|
||
|
include module type of IArray.Import
|
||
|
module Set = Set
|
||
|
module Map = Map
|
||
|
module Qset = Qset
|
||
6 years ago
|
|
||
5 years ago
|
(** Data types *)
|
||
5 years ago
|
|
||
5 years ago
|
module String : sig
|
||
|
include sig
|
||
|
include module type of Core.String with module Map := Core.String.Map
|
||
|
end
|
||
5 years ago
|
|
||
5 years ago
|
module Map : Map.S with type key = string
|
||
|
end
|
||
6 years ago
|
|
||
5 years ago
|
module Q : sig
|
||
|
include module type of struct include Q end
|
||
6 years ago
|
|
||
5 years ago
|
val of_z : Z.t -> t
|
||
6 years ago
|
val compare : t -> t -> int
|
||
|
val hash : t -> int
|
||
6 years ago
|
val hash_fold_t : t Hash.folder
|
||
|
val t_of_sexp : Sexp.t -> t
|
||
|
val sexp_of_t : t -> Sexp.t
|
||
6 years ago
|
val pp : t pp
|
||
6 years ago
|
end
|
||
5 years ago
|
|
||
5 years ago
|
module Z : sig
|
||
|
include module type of struct include Z end
|
||
5 years ago
|
|
||
|
val compare : t -> t -> int
|
||
|
val hash : t -> int
|
||
|
val hash_fold_t : t Hash.folder
|
||
|
val t_of_sexp : Sexp.t -> t
|
||
|
val sexp_of_t : t -> Sexp.t
|
||
|
val pp : t pp
|
||
5 years ago
|
val true_ : t
|
||
|
val false_ : t
|
||
|
val of_bool : bool -> t
|
||
|
val is_true : t -> bool
|
||
|
val is_false : t -> bool
|
||
5 years ago
|
end
|