IMDEA Software

IMDEA initiative

Home > Events > Invited Talks > 2018 > Optic algebras: beyond immutable data structures

Jesús López González

Thursday, April 12, 2018

10:45am Meeting room 302 (Mountain View), level 3

Jesús López González, PhD Student, Universidad Rey Juan Carlos & Habla Computing S.L., Spain

Optic algebras: beyond immutable data structures

Abstract:

Optics provide rich abstractions and composition patterns to access and manipulate immutable data structures. However, the state of real applications is mostly handled through databases, caches, web services, etc. In this effectful setting, the usefulness of optics is severely limited, whereas algebraic theories, thanks to their potential to abstract away from particular infrastructures, shine. Unfortunately, there is a severe lack of standard algebraic theories, e.g. like MonadState, that programmers can reuse to avoid writing their domain repositories from scratch. In this talk, we argue that optics can serve as a fruitful metaphor to design a rich catalogue of state-based algebras, and focus on the paradigmatic case of lenses. We show how lenses can be generalised into an algebraic theory; how compositionality of these algebraic theories can be founded on lens composition; and how to exploit the resulting abstractions in the modular design of data layers. We will use Coq to illustrate examples, definitions and proofs (LensAlgebra). Last, we will briefly introduce Stateless, a Scala library to bring optic algebras to the masses.