A Menagerie of Monads
April 16, 2019
This one-day, fast-moving workshop will help you answer both “how do I use Monads” as well as “why and when do I use them.”
We’ll begin with the familiar Array and Optional examples for map and flatMap as a way to motivate the definitions of and differences between Functors and Monads.
We’ll then explore examples of monads such as the State monad, the logging monad, and futures to see why we need both map and flatMap.
We’ll end the day by looking at an important function that lives between map and flatMap: apply.
By the end of the day you should have a strong mental model of Monads, Applicatives, and Functors and see how you might use them in your shipping applications to simplify your code.
The actual contents may vary on the day of training but the likely topics are:
Map in the standard library
FlatMap in the standard library
Pure and the connection between map and flatMap
Functors, Monads, and a brief look at Applicative Functors
The Result type - chaining steps together
The State monad - using a random number generator example
The Logging monad - generating a log as we go
This course assumes you are an experienced programmer who is confident with Swift. You will need a Mac running the latest version of Xcode.
About your instructor
Daniel is the author of the best selling books A Swift Kickstart and Developing iOS 7 Apps for iPad and iPhone (the official companion book to the popular iTunes U series from Stanford University taught by Paul Hegarty).
He has written apps for the iPhone and the iPad since the SDKs first appeared and has written programs for the Mac all the way back to System 7.
Daniel presents iPhone, Cocoa, and Swift training and consults through his company Dim Sum Thinking. His books are available on the iBookstore. When he’s not coding or talking about coding for the Mac, the iPhone, and the iPad he’s probably cooking or hanging out with his daughter.