Functional programing at its finest

updated about 1 year ago

This proposal has been withdrawn...

Swift has been around for a few years and many developers are now accustomed with the basic operations of functional programing, such as filter(), map() or reduce().

Still, most of the more advanced concepts have yet to reach a large audience, which is a real shame given the power they can bring to a code base.

This talks aims at introducing three of those advanced techniques :

  • The flatMap() operator and its many fields of application, such as building asynchronous streams, keeping a log of all the operations applied on a value or chaining together failable computations. (Yep, we're talking about Monads here)

  • Partial application of functions (also known as currying), which enables developers to manipulate the signature of a function, allowing them to easily write code that bridges different frameworks together or specialize existing functions in order to tailor them to their exact needs

  • Property-based testing, a sort of fuzzing-on-steroids approach in which developers use functions to write properties that describe the behavior of their program, and feed those properties to a testing engine that will then try to find counter-example for which the properties do not hold