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

Add In and For as a replacement of Each and ForEach #475

Closed
Atry opened this issue Nov 26, 2021 · 2 comments
Closed

Add In and For as a replacement of Each and ForEach #475

Atry opened this issue Nov 26, 2021 · 2 comments
Assignees
Milestone

Comments

@Atry
Copy link
Collaborator

Atry commented Nov 26, 2021

Foreach is a hidden keyword automatically generated from foreach calls, for example:

val reified: For[Await[Future[1]], Int, Unit] = for ($x <- Await(Future(1))) {
  print($x)
}

The return type should be
Foreach[Await[Future[Int]], Int, Unit]

In is just a wrapper of collection types to prevent the foreach/map/flatMap/withFilter methods defined on the collection, for example:

val ast3:
  FlatMap[
    Await[Int],
    Int,
    FlatMap[
      In[Int],
      Int,
      Pure[Int]
    ]
  ] =
for {
  i <- Await(Future(1))
  j <- In(0 until 10)
} yield 111

Both In and Foreach are supposed to be used along with for expression instead of !-notation.

@Atry Atry added this to the 2.0 milestone Nov 26, 2021
@Atry Atry self-assigned this Nov 26, 2021
@Atry
Copy link
Collaborator Author

Atry commented Nov 26, 2021

Note that the initial version of In and For will reuse type classes for Each and ForEach to make the migration easier.

@Atry Atry closed this as completed Dec 18, 2021
@Atry
Copy link
Collaborator Author

Atry commented Dec 18, 2021

See #477

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

No branches or pull requests

1 participant