Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@LukaszByczynski
Copy link
Contributor

@LukaszByczynski LukaszByczynski commented Sep 13, 2019

Resolves #1666.

Copy link
Member

@iravid iravid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @LukaszByczynski! I suggested a few slight tweaks to the signature.

/**
* Lifts a synchronous effect into `ZManaged[R, E, R]` with a release action.
*/
final def makeEffect[R, E, A](acquire: => A)(release: A => _): ZManaged[R, E, A] =
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
final def makeEffect[R, E, A](acquire: => A)(release: A => _): ZManaged[R, E, A] =
final def makeEffect[R, A](acquire: => A)(release: A => _): ZManaged[R, Throwable, A] =

* Lifts a synchronous effect into `ZManaged[R, E, R]` with a release action.
*/
final def makeEffect[R, E, A](acquire: => A)(release: A => _): ZManaged[R, E, A] =
make(Task(acquire).orDie)(a => Task(release(a)).orDie)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
make(Task(acquire).orDie)(a => Task(release(a)).orDie)
make(Task(acquire))(a => Task(release(a)).orDie)

/**
* See [[zio.ZManaged.makeEffect]]
*/
final def makeEffect[E, A](acquire: => A)(release: A => _): Managed[E, A] =
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
final def makeEffect[E, A](acquire: => A)(release: A => _): Managed[E, A] =
final def makeEffect[A](acquire: => A)(release: A => _): Managed[Throwable, A] =

@LukaszByczynski
Copy link
Contributor Author

@iravid Thanks for the review. I did suggested changes

Copy link
Member

@iravid iravid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @LukaszByczynski! Looks good :-)

@iravid iravid merged commit 044418d into zio:master Sep 14, 2019
fsvehla pushed a commit to fsvehla/zio that referenced this pull request Sep 21, 2019
…o#1667)

* Add a synchronous effect construction for the ZManaged (zio#1666)

* Changed error type to Throwable for makeEffect
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add method that allows lift a synchronous effect into ZManaged

2 participants