Journey to the Heart of the For-Yield

Preview:

DESCRIPTION

Options and IOs and Iteratees, oh my! If you've poked around at Scala you've seen it--the ubiquitous for-comprehension sprinkled through idiomatic Scala code. As it turns out, what looks like a bit of syntactic sugar to ease prosaic list manipulation is actually a super powerful structure for abstracting away all kinds of common operations in a safe and maintainable way. It allows you to take full advantage of type safety and pushes the work of setting up boilerplate to the compiler. We'll break down exactly what's going on in a for-comprehension and explore some of the wild and wonderful structures that can be used within one. You'll leave with a deeper understanding of the real-world benefits of functional programming. Or, to put it another way: for { attendees attendee } yourFpKnowledge

Citation preview

Journey to the Heart of the For-Yield

Kelsey Gilmore-Innishttp://nerd.kelseyinnis.com

@kelseyinnis

Sunday, October 20, 13

VANSunday, October 20, 13

Sunday, October 20, 13

What have you done for me lately?Sunday, October 20, 13

Sunday, October 20, 13

Sunday, October 20, 13

Sunday, October 20, 13

Sunday, October 20, 13

Sunday, October 20, 13

Sunday, October 20, 13

Sunday, October 20, 13

Sunday, October 20, 13

Sunday, October 20, 13

Sunday, October 20, 13

Sunday, October 20, 13

Sunday, October 20, 13

Sunday, October 20, 13

flatten compose map

flatMap

Sunday, October 20, 13

flatMap!

Sunday, October 20, 13

Sunday, October 20, 13

Sunday, October 20, 13

Sunday, October 20, 13

Sunday, October 20, 13

Sunday, October 20, 13

Sunday, October 20, 13

Sunday, October 20, 13

Enter Option

Sunday, October 20, 13

Enter Option

Sunday, October 20, 13

Enter Option

blergh!

Sunday, October 20, 13

blergh.

Sunday, October 20, 13

Sunday, October 20, 13

Sunday, October 20, 13

Sunday, October 20, 13

Smokey, this is not ‘Nam.There are rules.

Sunday, October 20, 13

the word

Sunday, October 20, 13

Sunday, October 20, 13

Sunday, October 20, 13

Sunday, October 20, 13

Sunday, October 20, 13

Sunday, October 20, 13

Sunday, October 20, 13

Sunday, October 20, 13

•Iteratee

•Reader

•Writer

•State

•IO

Other m-words

Sunday, October 20, 13

•I don’t wanna fail fast!• |@|

•Chocolate in my peanut butter? Peanut butter in my chocolate?

• .toSeq, monad transformers•It’s inside out!•traverse & sequence

But, but...

Sunday, October 20, 13

Sunday, October 20, 13

Recommended