This library defines disposables, composable first-class producers of values with associated external resources that must be allocated and deallocated such as database connections. Several safe abstractions are provided to consume disposable values while ensuring their associated resources are deallocated after use.
(define (connect!) (make-connection ...)) (define (disconnect! conn) (close-connection conn ...)) (define disposable-connection (disposable connect! disconnect!)) (with-disposable ([conn disposable-connection]) ... use conn ...)
Warning! This library is experimental; it may change in backwards incompatible ways without notice. As such, now is the best time for feedback and suggestions so feel free to open a repository issue or reach out to me directly.
This package provides several modules, all in the disposable collection: