Functional optics, like lenses and prisms, are incredible tools for manipulating data structures in a declarative and composable way.
Let’s take a deep dive into functional optics in Swift. In this talk we’ll explore more optic types than just Lens and Prism, and unlock their ability to compose at multiple levels.
We’ll then leverage composition to operate on complex data structures, avoid Optional handling with the Affine optic, and explore more sophisticated usages that go beyond data manipulation.
Lenses have gained some traction in the functional programming world, mainly in haskell. However, they are still viewed as a largely complicated, difficult, high level concept that is not really worth it to invest in learning or putting in your code base. It can be hard to get a good overview on what they actually are and how one can use them. They seem to be somewhat related to getters and setters, but what does that really mean? In addition, it seems to be one of the deepest rabbit holes around. Surely something like this can't be of interest for an everyday working programmer, trying to solve real world problems?
Wrong! In this talk, it's my goal to give a brief overview of what lenses are. But more importantly, I will also try to present a "slice" of the world of lenses that is not only directly applicable and useful in our daily work, but is also strangely familiar to people coming from an imperative/object oriented background.
Sara Fransson
Sara is a software engineer by day and a math enthusiast by night. Sometimes the two worlds collide (and sometimes they make them collide by banging them together). After having taken several trips back and forth between academia and industry in an attempt to balance their love for both the pure abstract theory and the practice of leveraging it to solve concrete problems, they have landed in the core banking domain at Klarna. There they are making themself busy spreading the gospel of functional programming and type theory. When they're not busy building a bank or trying to find time for studying, they enjoy cooking and eating tasty vegan food and playing tetris as fast as possible.
Find out more about the life at Klarna: https://www.klarna.com/careers/life-at-klarna/
Information about current job openings: https://www.klarna.com/careers/openings/