-
Couldn't load subscription status.
- Fork 1.4k
Issue 744 - Current Progress (checking about remove IO[Any,....]) #805
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The pull request contains a lot of files that shouldn't be there. I think maybe the IDE added them. Anyway, before I review, could you remove the following files from the pull request:
I think that'll clean it up quite a lot. 😅 |
|
@jdegoes My most recent commit has the files removed. |
|
The diff still contain Probably, it is better to only include |
|
@TheMayoras |
|
@jdegoes @AshishPrasad I ran |
|
@TheMayoras the Also, I think, you can run |
|
@TheMayoras Git is quite the beast to tame, don't let it stress you too much, and please give a holler if anything seems confusing. |
|
|
||
| def testAsyncIOEffectReturns = | ||
| unsafeRun(IO.effectAsyncM[Any, Throwable, Int](k => IO.effectTotal(k(IO.succeed(42))))) must_=== 42 | ||
| unsafeRun(IO.effectAsyncM[Throwable, Int](k => IO.effectTotal(k(IO.succeed(42))))) must_=== 42 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This are some really nice cleanups!
| // ALL error types in this trait must be a subtype of `UpperE`. | ||
| // TAKEN FROM ZIO_E_THROWABLE | ||
| // ALL environment types in this trait must be a supertype of `LowerR`. | ||
| type IoR = Any |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd delete this, I don't think you need it anymore, or all the temporary comments above and below.
|
|
||
| /** Accesses the whole environment of the effect. | ||
| */ | ||
| final def environment: ZIO[IoR, Nothing, IoR] = ZIO.access(ZIO.identityFn[IoR]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we know IoR will be Any, we can delete environment, as it is not useless for the IO type.
| * val portNumber = effect.access(_.config.portNumber) | ||
| * }}} | ||
| */ | ||
| final def access: ZIO.AccessPartiallyApplied[IoR] = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto for this, we know R = Any, so we can delete this method, since it won't be useful for IO.
|
|
||
| /** Effectfully accesses the environment of the effect. | ||
| */ | ||
| final def accessM: ZIO.AccessMPartiallyApplied[IoR] = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto for this, we know R = Any, so we can delete this method, since it won't be useful for IO.
| * This is similar to dependency injection, and the `provide` function can be | ||
| * thought of as `inject`. | ||
| */ | ||
| final def provide[E, A](r: IoR): ZIO[IoR, E, A] => IO[E, A] = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto for this, we know R = Any, so we can delete this method, since it won't be useful for IO.
| * (unsafely) execute tasks. This is useful for integration with | ||
| * non-functional code that must call back into functional code. | ||
| */ | ||
| final def runtime: ZIO[IoR, Nothing, Runtime[IoR]] = ZIO.runtime |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of using ZIO[IoR, ..., try: IO[..., i.e. omit the R parameter entirely by using the IO type synonym.
In fact, that can help keep this file on track: all the effect types will be IO or weaker (e.g. UIO for finalizers, etc.).
| * This method can be used for terminating a fiber because a defect has been | ||
| * detected in the code. | ||
| */ | ||
| final def die(t: Throwable): UIO[Nothing] = ZIO.die(t) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd delete all the comments in this file, later we can just link to ZIO documentation using the Scaladoc linking support:
/**
* See [[scalaz.zio.ZIO.die]]
*/| * stack. Manual use of this method can improve fairness, at the cost of | ||
| * overhead. | ||
| */ | ||
| final val yieldNow: UIO[Unit] = ZIO.Yield |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For all these files, try just to delegate to ZIO methods, not any of the data constructors directly.
| * composite fiber that produces unit. This version is faster than [[forkAll]] | ||
| * in cases where the results of the forked fibers are not needed. | ||
| */ | ||
| final def forkAll_[E, A](as: Iterable[ZIO[IoR, E, A]]): ZIO[IoR, Nothing, Unit] = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remember to replace all the ZIO[IoR, ... in this file with IO[....
| final def await: IO[E, A] = | ||
| IO.effectAsyncInterrupt[Any, E, A](k => { | ||
| var result = null.asInstanceOf[Either[Canceler, IO[E, A]]] | ||
| final def await: IO[Any, E, A] = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a typo, IO will only support 2 type parameters E and A, not the R type parameter. Same as below.
| def apply[A](a: => A): Task[A] = effect(a) | ||
|
|
||
| type TaskE = Throwable | ||
| type TaskR = Any |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd delete:
- All the temp comments
- The type aliases for
TaskEandTaskR - Scaladoc for all the functions (instead, we can link to ZIO sScaladoc)
| * The moral equivalent of `throw` for pure code. | ||
| * [[scalaz.zio.ZIO.fail]] | ||
| */ | ||
| final def fail(error: TaskE): IO[TaskE, Nothing] = ZIO.fail(error) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replace all IO[???, A] in this file by Task[A], and delete all the environmental functions (provide, accessM, access, environment, etc.), because R = Any, they won't be useful.
| * | ||
| * [[scalaz.zio.ZIO.runtime]] | ||
| */ | ||
| final def runtime: ZIO[TaskR, Nothing, Runtime[TaskR]] = ZIO.runtime |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd replace all the ZIO[TaskR, ...] by either Task (if the error is Throwable) or UIO (if the error is Nothing).
| */ | ||
| object TaskR { | ||
|
|
||
| type TaskrE = Throwable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As in the other cases, I'd delete:
- All the temp comments.
- The
TaskrEandTaskRtype synonyms - All the Scaladoc (instead link to ZIO Scaladoc)
| /** Returns an effect that models failure with the specified error. | ||
| * The moral equivalent of `throw` for pure code. | ||
| */ | ||
| final def fail(error: TaskrE): IO[TaskrE, Nothing] = ZIO.fail(error) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of IO[TaskrE, ...], use Task[...] everywhere in this file.
|
|
||
| /** Accesses the whole environment of the effect. | ||
| */ | ||
| final def environment[R]: ZIO[R, Nothing, R] = ZIO.access(ZIO.identityFn[R]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't really have a type alias for the combination but I see it a lot... we can fix it later.
| * This is similar to dependency injection, and the `provide` function can be | ||
| * thought of as `inject`. | ||
| */ | ||
| final def provide[R, A](r: R): ZIO[R, TaskrE, A] => IO[TaskrE, A] = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replace ZIO[R, TaskrE, ...] by TaskR[R, ...] in this whole file.
Yes, although I thought it was a
Yes, they are allowed to have |
|
As far as I can tell, Also, I get type errors when adding unsandbox to the I'm trying to fix a weird doc bug at the moment. It's giving me am ambiguous link for the |
All right, we can ignore it, then, we only need to worry about the
I will try to help tomorrow. Family day today! |
|
So everything seems to be working well except for the docs. Besides that, I think everything is finished. |
|
@TheMayoras Awesome work! 🎉 I had a chance to look at the Here's what's happening: when linking to the ZIO object methods, via To disambiguate them, we can specify more details, like the above error message suggests. Something like this should do the trick: You might have to play around to get the syntax exactly right. |
|
So I tried adding more details (like |
|
Also, the tests seem to pass most of the time. The failing jdk11 test passes most of the time. |
|
@TheMayoras How about for now, you just say: and not use a Scaladoc link? Don't worry about the flaky tests, they are not caused by this PR. 😄 |
|
I will fix it up when I get home at 6! Thank you so much for all of your help. I'm sure it's taken me longer than it should have, so thank you for your patience and help! |
|
@TheMayoras It's been a pleasure, and thank you for your help! |
| @@ -0,0 +1,91 @@ | |||
| package zio.interop.reactiveStreams | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file can be removed as it was moved to a separate repo
…moved from interop-reactiveStreams
…ight added to companion objects
|
It looks like the only failing test is that flaky |
|
@TheMayoras Thanks for your immense work on this mega-project, and your patience sorting through all the details. And congratulations on your first ZIO pull request! |
|
Thank you so much! It's been a journey, and I was more than a little scared to start with. You are a saint for helping me so much! |
…o#805) * message * done * class, classpath, project, settings removed * removed a lot of unnecessary files * sbt fmt run * Most method parameters have been changed to IO, UIO, Task, or TaskR. Methods organized alphabetically. Hopefully all other files were deleted. * .Project file removed * Scaladoc reformatted. Better return types for specific type aliases * .gitignore improved * Finished? * Conflicts Resolved? * conflicts turned back * Zio.scala sorted * gitignore improved? * gitignore improved? V2 * .gitignore. removed? * Issues with missing Classes and Functions * Ready? * Clone current file. Move all ZIO functions into ZIOFunctions. Moving all functions into object ZIO causes compilation errors. UIO, IO, Task, TaskR were copied into new clone * IO got interruptChildren * Inferred to Any errors fixed * ZIO.scala organized * grabbed changes from redone repo * Compiling after Merge. 'fmt' run. 'Docusaurus' throwing error about 'Cannot run program 'yarn'' * sbt fmt * Generalized mapAccumM signature zio#1029 (zio#1037) * Generalized mapAccumM signature * Fixed weird compiler error with explicit type parameters * Update util-core to 19.6.0 (zio#1039) * Update fs2-core to 1.0.5 (zio#1000) * Resolve ( zio#952 - Add links to resources) and fix documentation for effectBlockingCancelable (zio#978) * Resolves "Add user provided canceler to effectBlocking" (zio#966) * Add new effectBlockingCancelable method to blocking API * Add tests & documentation * Fix documentatation for effectBlockingCancelable and Add more resources to resources page (zio#952) * Add link to https://freskog.github.io/blog/2019/05/30/explore-zio-stm/ * Add link to https://github.com/freskog/stm-partitioning * Correct documentation for effectBlockingCancelable * DRY the build (zio#1019) * DRY the build Bring back JDK11 into build matrix * Disable Dotty builds * Apparently, apt runs on Ubuntu after bootup * Implement TracingStatus without bracket to fix a bug found in https://github.com/zio/zio/pull/1041/files#r295777382 (zio#1047) * Update sbt-dotty to 0.3.3 (zio#1042) * Update sbt-bloop to 1.3.2 (zio#1043) * Update sbt-microsites to 0.9.1 (zio#1044) * Update sbt-mdoc to 1.2.10 (zio#1045) * Return null guard for tracingStatus removed in zio#1047 (zio#1051) * Fix release errors (zio#1050) * Fix zio#987 Disable inlining during non-release builds (zio#1054) * Speed up builds (zio#1055) * Preserve errors in bracketExit when release dies (zio#1041) Similar to how `ensuring` works, we accumulate both errors in case `use` failed and `release` died. * Update rxjava to 2.2.10 (zio#1052) * Update sbt-mdoc to 1.3.1 (zio#1053) * Restore build on tags (zio#1056) * Restore build on tags * Fix syntax * Remove sneaky \t * Fix yarn install (zio#1057) * Fix yarn install (zio#1057) (zio#1058) * Fix yarn install (zio#1059) * Upgrade nodejs (zio#1060) * Upgrade nodejs (zio#1061) * Hold onto slippery fibers (zio#1063) * Hold onto slippery fibers * fmt * Fix typo in docs: aa -> a (zio#1066) * Fix node and yarn related issues for publishing microsite via circleci (zio#1068) * Fix node and yarn related issues for publishing microsite via circleci * Add nvm * Add nvm settings * Update dotty (zio#1062) * Cross compile using dotty * Fix dotty compilation errors * WIP: disable scala2 macros * Fix dotty compilation error in tests * Fix broken links in contributing docs (zio#1067) * sbt fmt run * sbt fmt run * Pulled in 6-24-19 9:21 * .sbtopts reverted back to the zio's heap size * Pulled in ignore and parallelErrors * Test errors fixed in IOSPec and RTSSSpec. fmt run * removed un-needed .idea, yarn.lock, node_modules * onInterrupt cleanup changed to ZIO[R1, Nothing, Any] * git pull. All files checked for missing methods. Explicit type paramater added to ZManageSpec.scala:210 in order to suppress compile error 'Type inferred to be * Disambiguated IO, Task, TaskR, UIO bracket and bracketExit ScalaDoc links * Fixed ScalaDoc links V2? * Fixed ScalaDoc links V3? * Fixed ScalaDoc links V4? * Fixed ScalaDoc links V5? * Fixed ScalaDoc links V6? * Testing different ScalaDoc links? * Testing different ScalaDoc links 2? * Testing different ScalaDoc links 3? * Testing different ScalaDoc links 4? * Testing different ScalaDoc links 5? * Change to @see annotation in companion objects * Removed ScalaDoc links to bracket and bracketExit. QueueSubscriber removed from interop-reactiveStreams * fmt run
I have not added Scaladoc links, moved traits to ZIO companion object, or organized in alphabetical order yet.