Skip to content
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

Support first order types #202

Closed
ajaychandran opened this issue Jan 4, 2024 · 5 comments · Fixed by #222
Closed

Support first order types #202

ajaychandran opened this issue Jan 4, 2024 · 5 comments · Fixed by #222
Labels
enhancement New feature or request good first issue Good for newcomers
Milestone

Comments

@ajaychandran
Copy link
Contributor

Is there an equivalent of wrapAll operator from zio-prelude?

Describe the solution you'd like

trait RefinedTypeOps[A, C, T]:

  inline def apply[F[*]](v: F[A :| C]): F[T]

  inline def assume[F[*]](v: F[A]): F[T]
@ajaychandran ajaychandran added the enhancement New feature or request label Jan 4, 2024
@ajaychandran ajaychandran changed the title Support first order types? Support first order types Jan 4, 2024
@Iltotore Iltotore added this to the 2.5.0 milestone Jan 11, 2024
@Iltotore
Copy link
Owner

I'm not sure how using the same name for wrapAll would play with overloading. Also I don't think replacing the old apply/assume with this implementation is a good idea because it would break binary compatibility and probably mess with type inference.

I suggest to use another name like applyF/assumeF or wrapAll.

@ajaychandran
Copy link
Contributor Author

+1 for applyF/assumeF.

@Iltotore
Copy link
Owner

After trying to implement it, I don't think it is possible to implement applyF without requiring something like a Monad/ForEach typeclass because wrapAll is not equivalent to applyF. It is similar to assumeF (aka just an alias for asInstanceOf[F[A]]).

@ajaychandran
Copy link
Contributor Author

I was thinking that applyF would have the same the same implementation (asInstanceOf[F[A]]) but I see now how this can be confusing.

I am fine with just assumeF. Also, it would be nice to have an extension method of the same name.

@Iltotore
Copy link
Owner

Iltotore commented Feb 4, 2024

Sounds like a good (and useful) idea to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants