scalawithcats / scala-with-cats

Source code for Scala with Cats
http://underscore.io/books/scala-with-cats
390 stars 129 forks source link

Make doMath calculation consistent with earlier examples #176

Open janekdb opened 4 years ago

janekdb commented 4 years ago

This makes the doMath example consistent with the earlier examples where 1 is added and then the result is multiplied by 2,

val func1 = (a: Int) => a + 1
val func2 = (a: Int) => a * 2
val func3 = (a: Int) => s"${a}!"
val func4 = func1.map(func2).map(func3)