package stdune

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Source file monad_intf.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
(** This module type is accessible as [Stdune.Monad.Basic] outside of [Stdune]. *)
module type Basic = sig
  type 'a t

  val return : 'a -> 'a t
  val bind : 'a t -> f:('a -> 'b t) -> 'b t
end

(** This module type is accessible as just [Stdune.Monad] outside of [Stdune]. *)
module type S = sig
  include Basic

  val map : 'a t -> f:('a -> 'b) -> 'b t

  module O : sig
    val ( >>| ) : 'a t -> ('a -> 'b) -> 'b t
    val ( >>= ) : 'a t -> ('a -> 'b t) -> 'b t
    val ( >>> ) : unit t -> 'a t -> 'a t
    val ( let+ ) : 'a t -> ('a -> 'b) -> 'b t
    val ( and+ ) : 'a t -> 'b t -> ('a * 'b) t
    val ( let* ) : 'a t -> ('a -> 'b t) -> 'b t
    val ( and* ) : 'a t -> 'b t -> ('a * 'b) t
  end
end

module type List = sig
  type 'a t

  val find_map : 'a list -> f:('a -> 'b option t) -> 'b option t
  val map : 'a list -> f:('a -> 'b t) -> 'b list t
  val concat_map : 'a list -> f:('a -> 'b list t) -> 'b list t
  val exists : 'a list -> f:('a -> bool t) -> bool t
  val iter : 'a list -> f:('a -> unit t) -> unit t
  val filter : 'a list -> f:('a -> bool t) -> 'a list t
  val filter_map : 'a list -> f:('a -> 'b option t) -> 'b list t
  val fold_left : 'a list -> f:('acc -> 'a -> 'acc t) -> init:'acc -> 'acc t
  val for_all : 'a list -> f:('a -> bool t) -> bool t
end

module type Option = sig
  type 'a t

  val iter : 'a option -> f:('a -> unit t) -> unit t
  val map : 'a option -> f:('a -> 'b t) -> 'b option t
  val bind : 'a option -> f:('a -> 'b option t) -> 'b option t
end

module type Result = sig
  type 'a t

  val iter : ('a, _) result -> f:('a -> unit t) -> unit t
end
OCaml

Innovation. Community. Security.