Academia.eduAcademia.edu

Less Is More: Generic Programming Theory and Practice

2012

Abstract

In Haskell, there is a clear distinction between values, types, and kinds. Values are built with constructors, such as True, which we colour in blue; we do not colour numerals, characters, or strings: Just 3, (Right 'p' Left "abc"). Datatypes, type synonyms, type variables, indexed families, and type classes are coloured in orange: Bool, Show α ⇒ Show [ α ], type family PF α. Kinds and kind variables are coloured in green: , → , Constraint. For simplicity we do not colour the arrow operator, as it can appear at different levels. Agda code The distinction between values and types is less clear in Agda. Our convention is to use blue for constructors (e.g. refl), orange for identifiers of type Set (e.g. _≡_), and green for identifiers of type Set 1 or (for simplicity) higher (e.g. Set). 2.2.3 Isomorphisms We have mentioned that some types are equivalent to others without formally defining this equivalence. When we say two types are equivalent we mean that they are isomorphic. The concept of isomorphism can be succinctly summarised as an Agda record type: