Book #23 - Functional Programming in Scala

Functional Programming in Scala, 2nd edition
by Michael Pilquist, Rúnar Bjarnason, and Paul Chiusano (MEAP, Summer 2022 estimated release)

 

Monday evenings, 5:00 pacific time / 7:00 central time

Meetup: https://www.meetup.com/the-south-padre-island-reading-group/events/286409630/
Zoom: https://us02web.zoom.us/j/84281187589
Discord: https://bit.ly/35RhGXM
Manning: https://www.manning.com/books/functional-programming-in-scala-second-edition
Source code (zip): https://www.manning.com/downloads/2363
Source code (github):


Finished!

Congratulations everyone, we’ve finished the book!

Parts 1-3: 2nd edition

Part 4: 1st edition

Let’s revisit Part 4 once it’s published in the second edition, expected in August. We could do an ad-hoc meeting.

Chapter 15
Stream processing and incremental I/0

May 30, 2022
June 6, 2022
June 13, 2022

Presenter

Chapter 15
Stream processing and incremental I/0

May 30, 2022
June 6, 2022
June 13, 2022

Presenter

15.1 Problems with imperative I/O: an example

Meisam - May 30

15.2 Simple stream transducers
15.2.1 Creating processes

Antonio - June 6

15.2.2 Composing and appending processes
15.2.3 Processing files

Casey - June 6

15.3 An extensible process type
15.3.1 Sources
15.3.2 Ensuring resource safety

Casey - June 13

15.3.3 Single-input processes
15.3.4 Multiple-input streams

 

15.3.5 Sinks
15.3.6 Effectful channels

 

15.3.7 Dynamic resource allocation
15.4 Applications

 

 

Chapter 14
Local effects and mutable state

May 23, 2022

Presenter

Chapter 14
Local effects and mutable state

May 23, 2022

Presenter

14.1 Purely functional mutable state

Casey

14.2 A data type to enforce scoping of side effects
14.2.1 A little language for scoped mutation
14.2.2 An algebra of mutable references

Casey

14.2.3 Running mutable state actions
14.2.4 Mutable arrays
14.2.5 A purely functional in-place quicksort

Meisam - May 30

14.3 Purity is contextual

Casey - May 30

 

Chapter 13
External effects and I/O

May 9, 2022
May 16, 2022
May 23, 2022

Presenter

Chapter 13
External effects and I/O

May 9, 2022
May 16, 2022
May 23, 2022

Presenter

13.1 Factoring effects

Casey - May 9

13.2 A simple IO type

Patrick - May 9

13.3 Avoiding the StackOverflowError

Meisam - May 16

13.4 A more nuanced IO type

Casey - May 16

13.5 Non-blocking and asynchronous I/O

Meisam - May 23

13.6 A general-purpose IO type

Jens - May 23

13.7 Why the IO type is insufficient for streaming I/O

Casey - May 23


NOTE - Chapters 10, 11, and 12 are now available in the Second Edition (as of April 3, 2022)

 

Chapter 12
Applicative and traversable functors

April 18, 2022
April 25, 2022
May 2, 2022

Presenter

Chapter 12
Applicative and traversable functors

April 18, 2022
April 25, 2022
May 2, 2022

Presenter

12.1 Generalizing monads

Casey - April 18

12.2 The Applicative trait

Meisam - April 18

12.3 The difference between monads and applicative functors

Patrick - April 18

12.4 The advantages of applicative functors

Casey - April 25

12.5 The applicative laws

Patrick - May 2

12.6 Traversable functors

Meisam - April 25

12.7 Uses of Traverse - 12.7.1 - 12.7.2

Meisam - May 2

12.7 Uses of Traverse - 12.7.3 - end

(?) Meisam - May 2

 

Homework for April 11

What type does Scala infer for the underscore in the answer to Exercise 11.8? Unit or Any?

(question posed by Meisam)

Answer: The Metals plugin for VSCode (recommened by Meisam) shows the type to be Any - Casey

Chapter 11
Monads

March 21, 2022
April 4, 2022
April 11, 2022

Presenter

Chapter 11
Monads

March 21, 2022
April 4, 2022
April 11, 2022

Presenter

Functors: generalizing the map function

Casey

Monads: generalizing the flatMap and unit functions

Patrick

Monadic combinators

Jens

Monadic combinators (exercises)

Jens - April 4

Monad laws
11.4.1 - 11.4.2

Casey - April 4

11.4.3 (after a look at Exercise 11.9)

Casey - April 11

Just what is a monad?

Meisam - April 11

 

Chapter 10
Monoids

March 7, 2022
March 14, 2022

Presenter

Chapter 10
Monoids

March 7, 2022
March 14, 2022

Presenter

What is a monoid?

Patrick

Folding lists with monoids

Jens

Associativity and parallelism

Casey - March 14

Example: Parallel parsing

Karthik - March 14

Typeclasses

Patrick - March 14

Foldable data structures

Patrick - March 14

Composing monoids

Meisam - March 14

 

Chapter 9
Parser combinators

February 21, 2022
February 28, 2022
March 7, 2022

Presenter

Chapter 9
Parser combinators

February 21, 2022
February 28, 2022
March 7, 2022

Presenter

Designing an algebra, first

Patrick

A possible algebra

Karthik

Handling context sensitivity

Casey - February 28, 2022

Writing a JSON parser

Meisam - February 28, 2022

Error reporting

Patrick - February 28, 2022

Implementing the algebra

Karthik - February 28, 2022

Exercises 9.15 and following

Karthik - March 7, 2022

 

Chapter 8
Property-based testing

February 7, 2022

February 14, 2022

Presenter

Chapter 8
Property-based testing

February 7, 2022

February 14, 2022

Presenter

A brief tour of property-based testing

Patrick

Choosing data types and functions

Patrick

Test case minimization

Meisam - February 14

Using the library and improving its usability

Meisam - February 14

Testing higher-order functions and future directions

Karthik - February 14

The law of generators

Karthik - February 14

 

Chapter 7
Purely functional parallelism
January 24, 2022
January 31, 2022

Presenter

Chapter 7
Purely functional parallelism
January 24, 2022
January 31, 2022

Presenter

Choosing data types and functions

Casey

Picking a representation

Meisam

The algebra of an API

Karthik - January 31

Refining combinators to their most general form

Casey - January 31

 

Chapter 6
Purely functional state

January 10, 2022
January 17, 2022

Presenter

Chapter 6
Purely functional state

January 10, 2022
January 17, 2022

Presenter

Generating random numbers using side effects

Patrick

Purely functional random number generation

Patrick

Making stateful APIs pure

Karthik

A better API for state actions

Casey - January 17

A general state action data type

Karthik - January 17

Purely functional imperative programming

Karthik - January 17

 

Chapter 5
Strictness and laziness

December 20, 2021
January 10, 2022

Presenter

Chapter 5
Strictness and laziness

December 20, 2021
January 10, 2022

Presenter

Strict and non-strict functions

Meisam

An extended example: lazy lists

Patrick

Separating program description from evaluation

Casey

Infinite streams and corecursion

Karthik - January 10

 

Chapter 4
Handling errors without exceptions

December 6, 2021
December 13, 2021

Presenter

Chapter 4
Handling errors without exceptions

December 6, 2021
December 13, 2021

Presenter

The good and bad aspects of exceptions

Patrick

Possible alternatives to exceptions

Karthik - December 13

The Option data type

Karhik - December 13

The Either data type

Meisam - December 13

 

Chapter 3

Functional data structures
November 29, 2021
December 6, 2021

Presenter

Chapter 3

Functional data structures
November 29, 2021
December 6, 2021

Presenter

Defining functional data structures

Patrick

Pattern matching

Jens

Data sharing in functional data structures

Karthik

Recursion over lists and generalizing to higher-order functions

Casey - To be continued - December 6

Trees

Meisam - December 6

 

Chapter 2
Getting started with functional programming in Scala

November 15, 2021

Presenter

Chapter 2
Getting started with functional programming in Scala

November 15, 2021

Presenter

Introducing Scala the language: an example

Casey

Running our program

Casey

Objects and namespaces

Casey

Higher-order functions: passing functions to functions

Casey

Polymorphic functions: abstracting over types

Casey

Following types to implementations

Patrick - November 29

 

Chapter 1
What is functional programming?

November 8, 2021

Presenter

Chapter 1
What is functional programming?

November 8, 2021

Presenter

The benefits of FP: a simple example

Casey

Exactly what is a (pure) function

Patrick

Referential transparency, purity, and the substitution model

Casey