package algaeff

  1. Overview
  2. Docs

Source file Fun.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
open StdlibShim

module Deep =
struct
  let finally k f =
    match f () with
    | x -> Effect.Deep.continue k x
    | exception e -> Effect.Deep.discontinue k e

  let reperform k e =
    finally k @@ fun () -> Effect.perform e
end

module Shallow =
struct
  let finally_with k f h =
    match f () with
    | x -> Effect.Shallow.continue_with k x h
    | exception e -> Effect.Shallow.discontinue_with k e h

  let reperform_with k e =
    finally_with k @@ fun () -> Effect.perform e
end
OCaml

Innovation. Community. Security.