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 getOrElse method #25

Merged
merged 5 commits into from
Feb 11, 2020
Merged

Add getOrElse method #25

merged 5 commits into from
Feb 11, 2020

Conversation

x0ji0d
Copy link

@x0ji0d x0ji0d commented Feb 7, 2020

No description provided.

@x0ji0d x0ji0d requested a review from t3hnar February 7, 2020 10:59
README.md Outdated Show resolved Hide resolved
@x0ji0d x0ji0d requested a review from t3hnar February 7, 2020 12:24

new Cache[F, K, V] {

def get(key: K) = cache.get(key)

def getOrElse(key: K, default: => F[V]): F[V] = get(key).flatMap(_.fold(default)(_.pure[F]))
Copy link
Contributor

Choose a reason for hiding this comment

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

going through changes, I can see that basically there is only one implementation available, should we maybe just add that as extension method via implicit class to ?

Copy link
Author

Choose a reason for hiding this comment

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

Put to the traits ¯_(ツ)_/¯

@x0ji0d x0ji0d requested a review from t3hnar February 11, 2020 10:19
@t3hnar t3hnar merged commit 2bb4b58 into master Feb 11, 2020
@i-surkov i-surkov deleted the pr/getOrElse branch May 26, 2023 11:18
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

Successfully merging this pull request may close these issues.

None yet

2 participants