Source file Monad.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
(*
   Implementation of synchronous computations.

   This implementation is replaced by something else when using Lwt or Async
   to represent deferred computations (promises).
*)

type 'a t = 'a

let return x = x
let bind x func = func x

let catch func handler =
  try func () with
  | exn ->
      let trace = Printexc.get_raw_backtrace () in
      handler exn trace