Skip to content

Instantly share code, notes, and snippets.

@sevanspowell
Created April 30, 2019 03:14
Show Gist options
  • Save sevanspowell/bcb15715f97ffe465fcd4451ec3bc5e2 to your computer and use it in GitHub Desktop.
Save sevanspowell/bcb15715f97ffe465fcd4451ec3bc5e2 to your computer and use it in GitHub Desktop.
Asynchronous Exceptions
withFileSystem basePath fs = ContT $ \action -> bracket
(liftIO $ do
createDirectoryIfMissing True basePath
instantiateFs basePath fs
)
(\_ -> uninterruptibleMask $ \_ -> do
liftIO $ removeDirectoryRecursiveIfExists basePath
)
action
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment