package zeit

  1. Overview
  2. Docs

Source file let.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
module Json = struct
  module Let_syntax = struct
    let map ~f x = Ppx_deriving_yojson_runtime.( >|= ) x f
  end
end

module Lwt_result = struct
  module Let_syntax = struct
    let bind ~f x =
      Lwt.bind x (function
        | Ok y ->
            f y
        | Error e ->
            Lwt.return_error e )


    let map ~f x =
      Lwt.map
        (function
          | Ok y ->
              Ok (f y)
          | Error _ as e ->
              e)
        x
  end
end

module Lwt = struct
  module Let_syntax = struct
    let bind ~f x = Lwt.bind x f

    let map ~f x = Lwt.map f x
  end
end