# Functional Programming Study Group #8

• Aug 6, 2014 · 6:00 PM
• openForce Information Technology GesmbH

Join us to discuss the book Functional Programming in Scala. Don't be scared: It's monads this time (chapter 11).

Please note:  we are using revision 14 of the book.

Yago has volunteered to lead us through the chapter.

We will  set up a Google hangout again for those of you who cannot join us in person. The link will be posted in the comments at the beginning of the meeting.

What do I have to do in order to join?

All you have to do is read the text (and RSVP).  But you will learn/benefit more in my experience if you also try to do some of the exercises.  If you put your solutions  somewhere publicly accessible (e.g. GitHub) or bring them to the meeting, we can discuss and compare different approaches

What does presenting a chapter involve?

There is no need to prepare slides or anything  like that. But you will need to read the text more closely to be able to summarise the individual sections of your chapter for us and lead and encourage the discussion. It will be your call to  separate the less important aspects from the more important ones, as we usually have only 90 mins in total for the discussion.

• ##### Peter B.

August 6, 2014

• ##### Andreas S.

I am sorry, I could not make it. Is there a maybe a recording of the hangout?

August 7, 2014

• ##### Bernhard H.

Hello,

I just wanted to add one more thing regarding the complicated filterM version I had in the beginning: The intention was to trigger those predicate calls all at once in the beginning before flat-mapping results together .. which is why the variable was called "evaluationTriggered". Especially with Futures this can make a HUGE difference. I've updated my Gist to show you what I mean, but it's essentially the same as with the difference between:

val fa = Future { x() }
val fb = Future { y() }
for {
a <- fa
b <- fb
} yield a + b

.. and ..

for {
a <- Future { x() }
b <- Future { y() }
} yield a + b

https://gist.github.com/bhuemer/b31e4ca21d2d0ea9e363 .. and I think once you add the types and add a few variable names it becomes much more obvious what this piece of code is doing.

1 · August 6, 2014

• ##### Bernhard H.

One more thing (.. famous last words ..), but obviously the eager evaluation of the predicate can also be a bad thing. For example, consider:

August 6, 2014

• ##### Bernhard H.

// This will only check one value and stop afterwards
val filteredOM = OptionMonad.filterM(valu­es){ value => println(s"Checking \$value"); Option.empty[Boolean] }
println(filteredOM)

// This will check all values .. only to return None in the end
val filteredOF = OptionMonad.filterF(valu­es){ value => println(s"Checking \$value"); Option.empty[Boolean] }
println(filteredOF)

August 6, 2014

• ##### Alexander D.

August 6, 2014

• ##### Peter N.

August 6, 2014

• ##### Dominik G.

August 6, 2014

• ##### Dominik G.

I'll be 5-10 min late, sorry. Just get started without me.

August 6, 2014

• ##### Andreas S.

I would like to attend, but will not make it. How can one join the hangout?

August 5, 2014

• ##### Yago A.

still better than the american system: val treatment: Option[Private]

August 6, 2014

• ##### Axel G.

Right(BeThere).toOption.­map(_.littleDelay)

August 6, 2014

• ##### Bernhard H.

I'll have to dial in as well :-/ .. can't attend physically.

August 6, 2014

• ##### Yago A.

I volunteer as tribute! Monads are going down!

1 · July 29, 2014

• ##### Axel G.

rock on!

August 1, 2014

• ##### Axel G.

Oh boy. I've got a lot of reading to do . . .

August 1, 2014

• ##### wolfgang w.

still on holidays

July 26, 2014

• ##### Christian H.

I hope I can get over the chapter in time.
The difficulty to follow the content now also starts to creep into the meetings for me.

1 · July 25, 2014

### Vienna, Austria

Founded Nov 4, 2012

#### Organizers:

• ##### openForce Information Technology GesmbH

Provides a venue for our meetings.

• ##### Stockwerk Coworking

Provides a venue for our meetings.

• ##### Sektor5 Coworking Spaces

Provides a venue for our meetings.

• ##### O'Reilly Verlag

Provides books and other great technical learning resources.

• ##### Manning Publications

Provides great technical e-books.

#### People in this Meetup are also in:

• ##### Open Knowledge Österreich MeetUp

464 Mitglieder

503 Campers

• ##### Python User Group Austria

566 Pythonistas

739 Members

• ##### IoT Vienna - The Internet of Things Group of Vienna

774 IoT Users

• ##### vienna.js Vienna JavaScript User Group

1,748 JavaScripters