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

Fix the Map for Option type #41

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tomohavvk
Copy link

@tomohavvk tomohavvk commented May 15, 2024

After the first touch of Option type I was confused how the Map is implemented.

In my understanding of functional programming the Map should be applied only for a value and return the value, and never return the no-value.

For case when need to apply function for a value and return Some or None the FlatMap should be used.

Before:

Some(1).
  Map(func(value int) (int, bool) {
    return value + 21, true
  })

After:

Some(1).
  Map(func(value int) int {
    return value + 21
  })

@tomohavvk tomohavvk changed the title Fix function Map for Option type Fix the Map for Option type May 15, 2024
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

1 participant