# Zippers

YOW! Lambda Jam 2019 - 01 Jan

The term zipper is a colloquial used to describe n-hole (most often, 1-hole) contexts. That is, a data structure that has a _hole_ or _pointer_ focused on a specific element with the ability to efficiently traverse to its neighbouring elements, providing an elegant solution for the need to efficiently traverse and _modify_ immutable data structures.

In this workshop, we will look at examples of zippers for canonical data structures such as lists and other products and sums. We will then define comonads and see the relationship between zippers and comonads.

This workshop will be a brief talk on zippers, partial derivatives and comonads, followed by solve some code exercises to get an intuition for zippers.

Participants will need to bring a suitable laptop with Glasgow Haskell Compiler (GHC) installed.

Finally, for a fun and interesting observation, we will look at the algebraic structure of products and sums, then compute the derivative of these structures. Turns out, a derivative of a data structure is its zipper ("McBride, Conor, et al (2005). ∂ for Data: Differentiating Data Structures").

## Tony Morris

Sr. Software Engineer

Queensland FP Lab, Data61

Australia

Tony Morris is a software product developer who has deployed functional programming techniques in industry for over 10 years. Tony teaches at the tertiary level and for professional programmers with a view toward producing a viable commercial result. Tony is currently a Senior Software Engineer at NICTA where he is tasked with promoting and educating on functional programming for the benefit of all Australian software developers.

Tony takes a fastidious, principled approach to functional programming both when deployed in practice and when in a learning environment to ensure maximum yield from the effort. Tony believes that exploring principles and the following consequences provides a rewarding experience for all involved.

## Workshop Details

- Target Audience
- Learning how to internalise zippers so that they can be applied in practice, with some theory for further study.
- Level
- Beginner
- Duration
- 1 hour 30min

### Learning Outcomes

- a solid understanding of the fundamental concept of a zipper as it relates to a data structure
- an internal vocabulary for the practical application of a zipper
- exploration of the interesting relationship between calculus (∫) and a zipper
- identify appropriate utilisation of an existing zipper for practical application
- calculate and write a zipper

### Workshop Outline

- introduce elementary data structures
- zippers for those data structures
- tools for internalising and forming a coherent concept of zipper
- solve practical problems for those data structures
- introduce the relationship between calculus and zippers
- calculate and apply our own zippers using calculus

### Prerequisites

There are no pre-requisites.