Skip to content

little fixes in "Explicit term inference" article #1173

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

Merged
merged 1 commit into from
Nov 10, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions _posts/2020-11-06-explicit-term-inference-in-scala-3.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ This pattern was particularly cumbersome to implement prior to Scala 3.
A typical approach would be the following:

```scala
implicit class ListTryExtension[A](val in: List[Try[A]]) extends AnyVal {
implicit class ListTryExtension[A](private val in: List[Try[A]]) extends AnyVal {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

or else useless method in is added to List[Try[A]]

def collectSucceeded: List[A] = ls.collect { case Success(a) => a }
def getIndexOfFirstFailure: Option[Int] =
in.zipWithIndex.find { case (t, _) => t.isFailure }
Expand Down Expand Up @@ -224,7 +224,7 @@ object Future {
}
```

We note again that we had to provide a name which might not be used for the variable. The `implictly` function from Scala 2 is renamed to `summon` in Scala 3.
We note again that we had to provide a name which might not be used for the variable. The `implicitly` function from Scala 2 is renamed to `summon` in Scala 3.

Finally the special import syntax allows users to explicitly import `given` instances by type rather than by name. This makes more sense since we usually refer to them by type as well.

Expand Down