You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We're doing some moderately cursed things in our test suite to share some global test resources, and as a result, we can't use ResourceT or bracket for resource control. Instead, we have records with a data Res = Res { cleanup :: IO () } field, and we call them manually when exiting the process. This works alright, but there are still some cases where we want guarantees similar to what ResourceT can provide.
An idea that I had was to use ResourceT but change the way we run the type:
Instead of calling stateCleanupChecked Nothing istate), we just return the IO action that does that. This should allow us to define resources in an exception-safe way, and then relinquish the resources when we're ready or able to do so outside of the block.
If we end up going with this, I'd be happy to try and upstream it, but I thought I'd write an issue just in case anyone else thought of it.
The text was updated successfully, but these errors were encountered:
We're doing some moderately cursed things in our test suite to share some global test resources, and as a result, we can't use
ResourceT
orbracket
for resource control. Instead, we have records with adata Res = Res { cleanup :: IO () }
field, and we call them manually when exiting the process. This works alright, but there are still some cases where we want guarantees similar to whatResourceT
can provide.An idea that I had was to use
ResourceT
but change the way we run the type:Instead of calling
stateCleanupChecked Nothing istate)
, we just return theIO
action that does that. This should allow us to define resources in an exception-safe way, and then relinquish the resources when we're ready or able to do so outside of the block.If we end up going with this, I'd be happy to try and upstream it, but I thought I'd write an issue just in case anyone else thought of it.
The text was updated successfully, but these errors were encountered: