# Names For Free - Polymorphic Views of Names and Binders Paper in proceeding, 2013

We propose a novel technique to represent names and binders in Haskell. The dynamic (run-time) representation is based on de Bruijn indices, but it features an interface to write and manipulate variables conviently, using Haskell-level lambdas and variables. The key idea is to use rich types: a subterm with an additional free variable is viewed either as $\forall v. v \rightarrow \mathsf{Term} (a + v)$ or $\exists v. v \times \mathsf{Term} (a + v)$ depending on weather it is constructed or analysed. We demonstrate on a number of examples how this approach approach permits to express terms construction and manipulation in a natural way, while retaining the good properties of representations based on de Bruijn indices.

type-classes

polymorphism

name binding

parametricity

nested types

## Author

### Jean-Philippe Bernardy

Chalmers, Computer Science and Engineering (Chalmers), Software Technology (Chalmers)

### Nicolas Pouillard

IT University of Copenhagen

#### SIGPLAN Notices (ACM Special Interest Group on Programming Languages)

0362-1340 (ISSN)

Vol. 48 12 13-24
978-145032383-3 (ISBN)

Information and Communication Technology

Basic sciences

Computer Science

### DOI

10.1145/2503778.2503780

978-145032383-3