Gabriella439 / Gabriella439/Haskell-Errors-Library

bracket

Open
#29 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Haskell
Stars
65
Forks
22
PR merge metrics
No merged PRs in 30d

Description

What do you think about adding a mimicking of the `bracket` function of `Exception`?
It ensures that the `release` action is performed before any errors of the `apply` are raised.

``` haskell
bracket ::
(Monad m) =>
EitherT e m a ->
(a -> EitherT e m b) ->
(a -> EitherT e m c) ->
EitherT e m c
bracket acquire release apply = do
r <- acquire
z <- lift $ runEitherT $ apply r
release r
hoistEither z
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.