Left (Error "Timeout") when using Aff.timeout in nested race conditions
28K reputation · 21 Feb 2022, 10:54 UTC
When using PureScript's Aff monad, a timeout implemented with Aff.timeout cancels the underlying fiber and runs its finalizers before returning a Left (Error \"Timeout\") result. The goal is to understand whether this cancellation behaves as an immediate asynchronous interrupt that can skip synchronous, effect‑free sections, or as a synchronous operation that guarantees finalizer execution even in nested race constructs. This distinction affects resource safety when multiple timeouts race with each other or with other computations.
- Does the cancellation point respect synchronous bind steps, or can it interrupt them?
- Are finalizers guaranteed to run when a timeout occurs inside a
racewhere the losing branch is cancelled? - What guarantees exist for nested
Aff.timeoutcalls where the outer timeout fires before the inner one?