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

Introduce flatMap in OptionExcercises2 #83

Closed
felipeeflores opened this issue May 3, 2018 · 2 comments
Closed

Introduce flatMap in OptionExcercises2 #83

felipeeflores opened this issue May 3, 2018 · 2 comments
Labels
question Further information is requested

Comments

@felipeeflores
Copy link
Contributor

should we introduce flatMap on findJobIdByHumanId.

At this point people understand what an Option type is and how/when to use it. findJobIdByHumanId is a very good example of how you combine two Options. The IDE suggest that you should use flatMap instead of map.flatten.

The next exercise findJobByHumanId has the same intuition. We could introduce it here to show the difference.

@felipeeflores felipeeflores added the question Further information is requested label May 3, 2018
@wjlow
Copy link
Owner

wjlow commented May 3, 2018

It will be introduced.

I don't want to give them flatMap as an answer.

We want to show them this progression:

  1. map then flatten
  2. flatMap
  3. for-comprehension

It'll make more sense in person, I hope :)

@felipeeflores
Copy link
Contributor Author

Cool. I thought so.
The hints could add some intuition? Like

here we are trying to combine two options?
how could this be more concise?

But I guess that's more like a presenter note.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants