Source

ocamlspot / utils.mli

module List : sig
  include module type of List
  val find_map_opt : ('a -> 'b option) -> 'a list -> 'b option
  val filter_map : ('a -> 'b option) -> 'a list -> 'b list
  val concat_map : ('a -> 'b list) -> 'a list -> 'b list
end

module Debug : sig
  val on : bool ref
  val format : ('a, Format.formatter, unit) format -> 'a
end

module Lazy : sig
  include module type of Lazy
  module Open : sig 
    val ( !! ) : 'a Lazy.t -> 'a 
    val eager : 'a -> 'a Lazy.t 
  end
  val peek : 'a t -> 'a option
  val apply : ('a -> 'b) -> 'a t -> 'b Lazy.t
  val is_val : 'a t -> bool
end
include module type of Lazy.Open

module Filename : sig
  include module type of Filename
  val split_extension : string -> string * string
  module Open : sig
    val (^/) : string -> string -> string
  end
end
include module type of Filename.Open

module Format : sig
  include module type of Format with type formatter = Format.formatter
  val list :
    (unit, formatter, unit) format (* seprator *)
    -> (formatter -> 'a -> unit) -> formatter -> 'a list -> unit
  val option :
    (formatter -> 'a -> unit) ->
    formatter -> 'a option -> unit
  val lazy_ :
    (formatter -> 'a -> unit) ->
    formatter -> 'a Lazy.t -> unit
end

module Option : sig
  val map : f:('a -> 'b) -> 'a option -> 'b option
  val bind : 'a option -> ('a -> 'b option) -> 'b option
  val iter : f:('a -> unit) -> 'a option -> unit
  val default : 'a -> 'a option -> 'a 
end

exception Finally of exn * exn

val protect : f:('a -> 'b) -> 'a -> finally:('a -> unit) -> 'b

module Unix : sig
  include module type of Unix

  type path = 
      { dir : string;
	base : string;
	path : string; (* dir / name *)
	stat : [ `Ok of stats | `Error of exn ];
	depth : int;
      }

  val prune : unit -> unit
  val find : f:(path -> unit) -> string list -> unit
end

module Hashtbl : sig
  include module type of Hashtbl with type ('a,'b) t = ('a, 'b) Hashtbl.t
  val of_list : int -> ('a * 'b) list -> ('a, 'b) Hashtbl.t
end
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.