Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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
@samber
Copy link
Owner

samber commented Jun 22, 2024

Since this introduces a breaking change, we must wait for v2.

@samber samber added the breaking-change Introduces changes that break backward compatibility or alter the public API. label Sep 25, 2025
@samber samber added this to the v2 milestone Sep 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking-change Introduces changes that break backward compatibility or alter the public API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants