April 30, 2019: Lugano, Switzerland: Protocol-oriented programming is strongly recommended in the Swift community, and Apple has given a lot of guidance on how to use it in your everyday code. However, there has not been a lot of attention on when it is not appropriate, and what to do in that case. We will explore this idea, and show that there is a completely straightforward and mechanical way to translate any protocol into a concrete datatype. Once you do this you can still write your code much like you would with protocols, but all of the complexity inherit in protocols go away. Even more amazing, a new type of composition appears that is difficult to see when dealing with only protocols. We will also demo a real life, open source library that was originally written in the protocol-oriented way, but after running into many problems with the protocols, it was rewritten entirely in this witness-oriented way. The outcome was really surprising, and really powerful.

December 2018: New Yrok, NY: In this talk I live code an implementation of a “seemingly impossible” Swift program. It’s one that for all intents and purposes should be impossible, yet somehow isn’t: we will perform an exhaustive search across an infinite space of values in finite time. Once this program is implemented I try to show some of the mathematics that explains how this could be true, and show that it has a surprising link to a field of mathematics known as topology.

I later turned this talk into a blog post “Seemingly Impossible Swift Programs”. All of the material in this talk can be found in a series of papers and articles by Martín Escardó:

October 2017: San Francisco, CA: A rapid tour through what is required of a server-side web framework, and how Swift’s type system can help solve very complex problems in an expressive and safe way. I mostly focus on:

Server middleware as just a function that takes a request and produces a response. We use a technique known as phantom types to actually model the entire request-to-responsive lifecycle directly in the type system.

An applicative style router that is invertible. This means it can both route requests to a first class value, and print requests from a value. It is based on the ideas in this paper.

Lifting HTML and CSS views into Swift types so that we can transform them in new and interesting ways.

Using Xcode and the Swift toolchain to do painless snapshot testing, screenshot testing and using Swift playgounds to create entire webpages.

The talk covers a lot of the core ideas that went into building the Point-Free website, which is fully open source.

Composable Reducers

September 2017: Berlin: I gave this talk at the Functional Swift Conference in Berlin, and it entirely focuses on the composability properties of reducers, which are functions of the form (S, A) -> S. Turns out, there are lots of nice ways to compose such functions, and when applied to ways to model application state (e.g. in Elm and Redux), we show that this allows one to write very simple, local reducers while still leaving yourself open to compose them in a global manner.

Playground-Driven Development

September 2017: Paris: I gave this talk at FrenchKit in Paris, and it goes a little bit deeper into the topic I first discussed on “Swift Talk” with Chris Eidhof. It shows how we can replace a large portion of our everyday work in simulators and storyboards with Swift playgrounds. Towards the end of the talk I give a small preview of how I’ve even been using playgrounds to do server-side Swift development.

Anything you can do, I can do better

May 2017: Berlin: My colleague Lisa Luo and I gave a talk at UIKonf about how we unify our foundations across iOS and Android by building off of functional programming in Swift and Kotlin.

Swift Talks

April 2017: Brooklyn, NY: Chris Eidhof and Florian Kugler of objc.io invited me to record a few guest appearances on their “Swift Talks” series about Kickstarter’s newly open-sourced code. It was a great opportunity to show how functional programming can be applied to a large codebase in real life.

Brandon from Kickstarter joins us to discuss deep linking into an iOS app. We show how to unify all potential entry points into the app using a common route enum, and then we take a look at this pattern in Kickstarter’s open source codebase.

Brandon from Kickstarter is back to show us how the company uses playgrounds to prototype and style individual view controllers.

Monoids, Predicates and Sorting Functions

April 2017: Brooklyn, NY: At the 2017 Functional Swift Conference in Brooklyn I spoke about small atomic units of abstractions can piece together to build surprisingly complex, yet expressive, components. In particular, I used semigroups and monoids to build an expressive algebra for predicates and sorting functions. This talk is roughly based on the article I wrote “The Algebra of Predicates and Sorting Functions”.

March 2017: Tokyo: There are precisely two things that make functions fully testable: the isolation of effects and the surfacing of ‘co-effects’. We will explore a bit of the formal theory behind these two sides, and show how they lead to code that can be easily tested. We will also show how we do this at Kickstarter by diving into our recently open sourced codebase.

Finding Happiness in Functional Programming

Oct 2016: Budapest At the 2016 Functional Swift Conference in Budapest I spoke about how embracing simple, pure functions above all other abstractions has enabled my colleagues and me to build a well-tested, well-understood codebase. I first covered the basics of pure functions and the ideas of identifying effects and separating them from your functions. I then described how these ideas allowed us better our testing suites, enabled us to replace simulators and storyboards with Swift playgrounds, and ultimately a better working relationship with engineers, designers and product managers.

Lenses in Swift

Proof in Functions

Feb 2015: Brooklyn, NY At the Brooklyn Swift Meetup I described how we can use the Swift type system to prove simple mathematical theorems. This talk covers most of everything I discussed in my post “Proof in Functions”.

Functional Programming in a Playground

Dec 2014: Brooklyn, NY At the 2014 Functional Swift Conference in Brooklyn I used Swift playgrounds as a highly interactive way for exploring functional programming ideas. In particular, I developed the ideas of transducers and show how they lead to highly composable data transformations.