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 unassignOrGiveUp #288

Merged
merged 7 commits into from
Mar 14, 2024
Merged

Conversation

Masynchin
Copy link
Contributor

#287 (comment) - done!

The only difference expect for naming, is the usage of traverse_ instead of traverse.

Is there possibility and necessity to replace state.updated with state.add? Should be other methods be renamed?

@Masynchin
Copy link
Contributor Author

For the given code block:

val io = maybeGivenUp.traverse_(task =>
  Logger[IO].warn(s"Give up move due to invalid move $response by $key for $task")
)

I was trying to use new function syntax with maybeGivenUp.traverse_: task =>, but got syntax error, strange

@lenguyenthanh
Copy link
Member

The only difference expect for naming, is the usage of traverse_ instead of traverse.

This is a good optimization 👍

Is there possibility and necessity to replace state.updated with state.add? Should be other methods be renamed?

They're the same but also not quite.
AppState is an opaque type with the underlying type is a Map. For object outside of AppState, they can't access to Map's functions they can only access to what We define in AppState object. So that's why we can use state.updated in AppState, but in Executor We need to use state.add

@lenguyenthanh
Copy link
Member

I was trying to use new function syntax with maybeGivenUp.traverse_: task =>, but got syntax error, strange

So, any function that ends with symbol cannot use fewer braces syntax.

@lenguyenthanh lenguyenthanh merged commit 7463f49 into lichess-org:master Mar 14, 2024
2 checks passed
@Masynchin
Copy link
Contributor Author

So, any function that ends with symbol cannot use fewer braces syntax.

TIL, thanks!

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.

2 participants