Scala Notes
Scala
Notes from «Functional Programming in Scala»
The Option
class in
Option.scala
and the RNG
class in
State.scala
have examples of using flatMap
to implement map2
. The pattern is common, but
a bit weird. Stare at it for a while if you want to figure out how powerful
flatMap
is.