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

Skip to content

Conversation

@wi101
Copy link
Contributor

@wi101 wi101 commented Feb 25, 2019

No description provided.

"-Xsource:2.13",
"-Ywarn-numeric-widen",
"-Ywarn-value-discard",
"-Xfatal-warnings"
Copy link
Member

Choose a reason for hiding this comment

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

Why are you dropping fatal warnings?

Copy link
Contributor Author

@wi101 wi101 Feb 25, 2019

Choose a reason for hiding this comment

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

There were some warnings,
thanks, I added those lines again

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't know how my comment disappear :D !

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@NeQuissimus I added this plugin:

addSbtPlugin("com.thoughtworks.sbt-api-mappings" % "sbt-api-mappings"  % "3.0.0")

@NeQuissimus
Copy link
Member

you guys... breaking everything I've built so far and not making me feel bad about it...

@tabdulradi
Copy link
Contributor

I asked the following question in the meetup tonight

Is it possible to partially provide environment? Like R1 => ZIO[R1 with R2, E, A] => ZIO[R2, E, A]

Now thinking about using HLists instead of intersection types. R1 => ZIO[R1 :: R2 :: HNil, E, A] => ZIO[R1 :: HNil, E, A] should be possible, what do you think? 🤔

* arguments to the program and has to return an `IO` with the errors fully handled.
*/
def run(args: List[String]): IO[Nothing, ExitStatus]
def run(args: List[String]): ZIO[Environment, Nothing, Int]
Copy link
Member

Choose a reason for hiding this comment

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

I feel something like a ReturnCode that is equivalent to an unsigned byte would be clearer here than Int. Exit codes are 0 <= x <= 255.

*/
final def repeatOrElseEither[R1 <: R, B, E2, C](
schedule: Schedule[R1, A, B],
orElse: (E, Option[B]) => ZIO[R1 with Clock, E2, C]
Copy link
Member

Choose a reason for hiding this comment

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

Why does R1 need the with Clock here but not in the orElse above?
I am clearly missing something :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

in repeatOrElseEither we used Schedule which has Clock now


implicit final val ZIOIO: ZIO[IO] = new ZIO[IO] {
final def liftZIO[E, A](io: IO[E, A]): IO[E, A] = io
trait ZIO_E_Any extends ZIO_E_Throwable {
Copy link
Member

Choose a reason for hiding this comment

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

I am not a fan of these strange trait names...

Copy link
Member

Choose a reason for hiding this comment

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

I'll clean them up in followup PR.

@NeQuissimus
Copy link
Member

It would be great to provide additional documentation for the microsite.
ZIO is no longer immediately "familiar" and I feel the improvements in this PR require additional information. The standard IO[A] most people are familiar with. IO[E, A] was easily explained. The concept of the environment here is not as intuitive.

@dwijnand
Copy link

Additionally, I fear this introduces the ambiguity of when one says "zio"/"ZIO" they mean the library or the datatype in that library. I caught myself today saying "scalaz-zio's ZIO datatype" which is a mouthful. Maybe I should've said "scalaz's ZIO datatype", which is defined in the scalaz-zio foundation library.

}
trait Live extends Random {
val random: Service[Any] = new Service[Any] {
import scala.util.{ Random => SRandom }
Copy link
Contributor

Choose a reason for hiding this comment

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

Excuse my intrusion on this package given my absence in scala, but this is effectively just using a global random instance, even if it's observably pure. I'm not precisely sure that's a great thing to expose.

Copy link
Member

@regiskuckaertz regiskuckaertz left a comment

Choose a reason for hiding this comment

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

This PR is so much love 😍 Just giving my vote. You totally rock @wi101 and @jdegoes !


```scala
type Task[A] = IO[Throwable, A]
type Task[A] = Task[A]
Copy link
Contributor

Choose a reason for hiding this comment

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

type Task[A] = Task[A]?

@emilypi
Copy link

emilypi commented Feb 26, 2019

Killing it 👍

I'll give a review this weekend.

@landerlo
Copy link
Contributor

I asked the following question in the meetup tonight

Is it possible to partially provide environment? Like R1 => ZIO[R1 with R2, E, A] => ZIO[R2, E, A]

Now thinking about using HLists instead of intersection types. R1 => ZIO[R1 :: R2 :: HNil, E, A] => ZIO[R1 :: HNil, E, A] should be possible, what do you think? thinking

@tabdulradi We would lose type inference and incur a severe dispatch performance penalty. What you want should be trivial in dotty when we have proper intersection types.

@jdegoes
Copy link
Member

jdegoes commented Feb 26, 2019

@tabdulradi Should be possible! 💡 ZIO itself makes no requirements on environmental subtyping, but subtyping is supported if you want to use it (via auto-widening in flatMap).

Also some really interesting things become possible with higher-kinded R.

This is an area of active exploration in Scala... 🔎

@jdegoes jdegoes merged commit 4e9f629 into zio:master Feb 26, 2019
@jdegoes
Copy link
Member

jdegoes commented Feb 26, 2019

There's some good feedback here. Since this has already had 3 full reviews prior to opening and several more since then, I'm going to go ahead and merge, and address minor cleanup and major documentation in followup PRs.

@oscarvarto
Copy link
Contributor

@wi101 and @jdegoes Thanks for all your efforts.
I'm very eager to read your documentation.

@edmundnoble
Copy link
Contributor

@tabdulradi That will likely require macros. I've seen people try to construct A with B given an A and a B, but never seen success.

* Lifts an `IO[E, R]`` into `Managed[E, R]`` with a release action.
*/
final def make[E, R](acquire: IO[E, R])(release: R => IO[Nothing, _]): Managed[E, R] =
final def make[R, E, A](acquire: ZIO[R, E, A])(release: A => UIO[_]): Managed[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.

Shouldn't release be a ZIO[R1, Nothing, _]? Similar to IO.bracket?

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.