package reason-standard

  1. Overview
  2. Docs

Source file Standard.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
module Bool = Core.Bool

module Char = Core.Char

module Int = Core.Int

module Integer = Core.Integer

module Float = Core.Float

module String = Core.String

module Option = struct
  include Core.Option

  (** The {{: https://caml.inria.fr/pub/docs/manual-ocaml/bindingops.html } binding operator} 
      for {!Core.Option.map}

      {b Note} Currently this is only supported by the OCaml syntax.

      {b Note} This requires at least OCaml 4.08 which means currently this is 
      only supported by the native compiler.
  *)
  let (let+) (t : 'a t) (f : 'a -> 'b) : 'b t = map t ~f 

  (** The {{: https://caml.inria.fr/pub/docs/manual-ocaml/bindingops.html } binding operator} 
      for {!Core.Option.both}

      {b Note} Currently this is only supported by the OCaml syntax.

      
      {b Note} This requires at least OCaml 4.08 which means currently this is 
      only supported by the native compiler.
  *)
  let (and+) (t : 'a t) (t' : 'b t) : ('a * 'b) t = both t t'

  (** The {{: https://caml.inria.fr/pub/docs/manual-ocaml/bindingops.html } binding operator} 
      for {!Core.Option.flatMap}

      {b Note} Currently this is only supported by the OCaml syntax.

      
      {b Note} This requires at least OCaml 4.08 which means currently this is 
      only supported by the native compiler.
  *)
  let (let*) (t : 'a t) (f : 'a -> 'b t) : 'b t =  
    flatMap t ~f 


  (** The {{: https://caml.inria.fr/pub/docs/manual-ocaml/bindingops.html } binding operator} 
      for {!Core.Option.both}

      {b Note} Currently this is only supported by the OCaml syntax.
      
      {b Note} This requires at least OCaml 4.08 which means currently this is 
      only supported by the native compiler.
  *)
  let (and*) (t : 'a t) (t' : 'b t) : ('a * 'b) t =
    both t t'
end

(* This requires 4.08 *)
module Result = struct
  include Core.Result

  (** The {{: https://caml.inria.fr/pub/docs/manual-ocaml/bindingops.html } binding operator} 
      for {!Core.Result.map}

      {b Note} Currently this is only supported by the OCaml syntax.
      
      {b Note} This requires at least OCaml 4.08 which means currently this is 
      only supported by the native compiler.
  *)
  let (let+) (t : ('a, 'error) t) (f : 'a -> 'b) : ('b, 'error) t = 
    map t ~f 

  (** The {{: https://caml.inria.fr/pub/docs/manual-ocaml/bindingops.html } binding operator} 
      for {!Core.Result.both}

      {b Note} Currently this is only supported by the OCaml syntax.
      
      {b Note} This requires at least OCaml 4.08 which means currently this is 
      only supported by the native compiler.
  *)
  let (and+) (t : ('a, 'error) t) (t' : ('b, 'error) t) : (('a * 'b), 'error) t =
    both t t'

  (** The {{: https://caml.inria.fr/pub/docs/manual-ocaml/bindingops.html } binding operator} 
      for {!Core.Result.flatMap}

      {b Note} Currently this is only supported by the OCaml syntax.
      
      {b Note} This requires at least OCaml 4.08 which means currently this is 
      only supported by the native compiler.
  *)
  let (let*) (t : ('a, 'error) t) (f : 'a -> ('b, 'error) t) : ('b, 'error) t = 
    flatMap t ~f 

  (** The {{: https://caml.inria.fr/pub/docs/manual-ocaml/bindingops.html } binding operator} 
      for {!Core.Result.both}

      {b Note} Currently this is only supported by the OCaml syntax.
      
      {b Note} This requires at least OCaml 4.08 which means currently this is 
      only supported by the native compiler.
  *)
  let (and*) (t : ('a, 'error) t) (t' : ('b, 'error) t) : (('a * 'b), 'error) t = 
    both t t'  
end

module Tuple = Core.Tuple

module Tuple3 = Core.Tuple3

module Array = Core.Array

module List = Core.List

module Set = Core.Set

module Map = Core.Map

module Container = Core.Container

module Comparator = Core.Comparator

module Fun = Core.Fun