
Hi Tristan, how about the async-refresh package (https://hackage.haskell.org/package/async-refresh)? Looks close to what you have written — from the README: About This is Haskell library implementing the logic for refreshing of expiring data according to user-provided actions. Usage * Create a new configuration using newAsyncRefreshConf, providing the action to be used for data refreshing. * Adjust the configuration using the asyncRefreshConfSet* functions, in particular using asyncRefreshConfSetCallback. * Use newAsyncRefresh to initiate a new thread managing the asynchronous refreshing. [...] It is currently used by the package async-refresh-tokens (https://hackage.haskell.org/package/async-refresh-tokens), which specializes the async-refresh package to the refreshing of expiring authentication tokens. If you have questions or suggestions, feel free to open issues and/or contact me directly. Best, Moritz