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

Review API usage to improve UX #3

Merged
merged 1 commit into from
Apr 27, 2022
Merged

Review API usage to improve UX #3

merged 1 commit into from
Apr 27, 2022

Conversation

pdalpra
Copy link

@pdalpra pdalpra commented Apr 26, 2022

  • Add variants of *All methods with varargs, to avoid wrapping
    everything in Sets
  • Move the mapping function to a separate parameter list, to improve
    cases where you’d want to have a more complex function as a block
    expression

Before:

cache.getAll(Set("key", "key2"))(keys => {
  val foo = ???
  ZIO
    .attempt(foo)
    .orElse(ZIO.attempt(???))
    .orElseSucceed(???)
})

After:

cache.getAll("key", "key2") { keys =>
  val foo = ???
  ZIO
    .attempt(foo)
    .orElse(ZIO.attempt(???))
    .orElseSucceed(???)
}

@pdalpra pdalpra requested review from aartigao and miguelpuyol April 26, 2022 14:12
@pdalpra pdalpra force-pushed the review-api-usage branch 3 times, most recently from dd5bdca to 4a4bc26 Compare April 26, 2022 14:20
Copy link
Contributor

@aartigao aartigao left a comment

Choose a reason for hiding this comment

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

LGTM!

* Add variants of `*All` methods with varargs, to avoid wrapping
  everything in Sets
* Move the mapping function to a separate parameter list, to improve
  cases where you’d want to have a more complex function as a block
  expression

Before:

```
cache.getAll(Set("key", "key2"))(keys => {
  val foo = ???
  ZIO
    .attempt(foo)
    .orElse(ZIO.attempt(???))
    .orElseSucceed(???)
})
```

After:

```
cache.getAll("key", "key2") { keys =>
  val foo = ???
  ZIO
    .attempt(foo)
    .orElse(ZIO.attempt(???))
    .orElseSucceed(???)
}
```
Copy link

@miguelpuyol miguelpuyol left a comment

Choose a reason for hiding this comment

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

👍

@pdalpra pdalpra merged commit 454db23 into main Apr 27, 2022
@pdalpra pdalpra deleted the review-api-usage branch April 27, 2022 11:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants