Introduce `flatMap` in `OptionExcercises2`
felipeeflores opened this issue · 2 comments
felipeeflores commented
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 Option
s. 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.
wjlow commented
It will be introduced.
I don't want to give them flatMap
as an answer.
We want to show them this progression:
- map then flatten
- flatMap
- for-comprehension
It'll make more sense in person, I hope :)
felipeeflores commented
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.