package hack_parallel
Parallel and shared memory library
Install
Dune Dependency
Authors
Maintainers
Sources
1.0.1.tar.gz
md5=ba7c72bc207e326b72e294fc76f6ad2c
sha512=5020d47f97bea2f88e2a40411894d03232a7f2282606926c93c7d4c96d72e94a966be852897a9b16f7e0893ba376512045abb9d93020a7c03c3def4f3d918f8e
doc/src/hack_parallel.hack_core/hack_result.ml.html
Source file hack_result.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
module Stable = struct module V1 = struct type ('a, 'b) t = ('a, 'b) Pervasives.result = | Ok of 'a | Error of 'b end end include Stable.V1 type ('a, 'b) _t = ('a, 'b) t include Hack_monad.Make2 (struct type ('a, 'b) t = ('a,'b) _t let bind x f = match x with | Error _ as x -> x | Ok x -> f x let map x ~f = match x with | Error _ as x -> x | Ok x -> Ok (f x) let map = `Custom map let return x = Ok x end) let fail x = Error x;; let failf format = Printf.ksprintf fail format (* This definition shadows the version created by the functor application above, but it is much more efficient. *) let map t ~f = match t with | Ok x -> Ok (f x) | Error _ as x -> x let map_error t ~f = match t with | Ok _ as x -> x | Error x -> Error (f x) let is_ok = function | Ok _ -> true | Error _ -> false let is_error = function | Ok _ -> false | Error _ -> true let ok = function | Ok x -> Some x | Error _ -> None let error = function | Ok _ -> None | Error x -> Some x let of_option opt ~error = match opt with | Some x -> Ok x | None -> Error error let iter v ~f = match v with | Ok x -> f x | Error _ -> () let iter_error v ~f = match v with | Ok _ -> () | Error x -> f x let ok_fst = function | Ok x -> `Fst x | Error x -> `Snd x let ok_if_true bool ~error = if bool then Ok () else Error error let try_with f = try Ok (f ()) with exn -> Error exn let ok_unit = Ok () let ok_exn = function | Ok x -> x | Error exn -> raise exn let ok_or_failwith = function | Ok x -> x | Error str -> failwith str module Export = struct type ('ok, 'err) _result = ('ok, 'err) t = | Ok of 'ok | Error of 'err let is_error = is_error let is_ok = is_ok end let combine t1 t2 ~ok ~err = match t1, t2 with | Ok _, Error e | Error e, Ok _ -> Error e | Ok ok1 , Ok ok2 -> Ok (ok ok1 ok2 ) | Error err1, Error err2 -> Error (err err1 err2) ;;
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>