Skip to content

Instantly share code, notes, and snippets.

@sevanspowell
Created April 30, 2019 03:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • 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