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

Skip to content

Conversation

@stkeky
Copy link
Contributor

@stkeky stkeky commented Nov 3, 2019

closes #2076

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.

Almost there! Nice work!

/**
* Extracts [[Reservation]] from within.
*/
final def unapply[E, A](v: Managed[E, A]): Option[ZIO[Any, E, Reservation[Any, 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.

We can skip unapply. No real use for it

* some checked error, as per the type of the functions provided by the resource.
*/
final case class ZManaged[-R, +E, +A](reserve: ZIO[R, E, Reservation[R, E, A]]) { self =>
final class ZManaged[-R, +E, +A] private (val reserve: ZIO[R, E, Reservation[R, E, A]]) extends Serializable { self =>
Copy link
Member

Choose a reason for hiding this comment

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

Let's make reserve just a constructor parameter, and not a field:

Suggested change
final class ZManaged[-R, +E, +A] private (val reserve: ZIO[R, E, Reservation[R, E, A]]) extends Serializable { self =>
final class ZManaged[-R, +E, +A] private (reservation: ZIO[R, E, Reservation[R, E, A]]) extends Serializable { self =>

And add an accessor method:

def reserve: ZIO[R, E, Reservation[R, E, A]] =  reservation

@stkeky
Copy link
Contributor Author

stkeky commented Nov 3, 2019

@iravid Thank you for your review, I addressed the issues.

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.

Great work! Thank you!

@iravid iravid merged commit 3e27ce4 into zio:master Nov 3, 2019
ghostdogpr pushed a commit to ghostdogpr/scalaz-zio that referenced this pull request Nov 5, 2019
* Make parts of ZManaged private

* Make ZManaged serializable

* Address code remarks
Twizty pushed a commit to Twizty/zio that referenced this pull request Nov 13, 2019
* Make parts of ZManaged private

* Make ZManaged serializable

* Address code remarks
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.

Make parts of ZManaged private

2 participants