package algaeff

  1. Overview
  2. Docs

Useful helper functions for deep handlers.

val finally : ('a, 'b) Stdlib.Effect.Deep.continuation -> (unit -> 'a) -> 'b

finally f runs the thunk f and calls continue if a value is returned and discontinue if an exception is raised. Here is an example that calls List.nth and then either returns the found element with continue or raises the exception Not_found with discontinue.

Algaeff.Fun.Deep.finally k @@ fun () -> List.nth elements n