Skip to main content
    • Aa
    • Aa

The essence of ornaments


Functional programmers from all horizons strive to use, and sometimes abuse, their favorite type system in order to capture the invariants of their programs. A widely used tool in that trade consists in defining finely indexed datatypes. Operationally, these types classify the programmer's data, following the ML tradition. Logically, these types enforce the program invariants in a novel manner. This new programming pattern, by which one programs over inductive definitions to account for some invariants, lead to the development of a theory of ornaments (McBride, 2011 Ornamental Algebras, Algebraic Ornaments. Unpublished). However, ornaments originate as a dependently-typed object and may thus appear rather daunting to a functional programmer of the non-dependent kind. This article aims at presenting ornaments from first-principles and, in particular, to declutter their presentation from syntactic considerations. To do so, we shall give a sufficiently abstract model of indexed datatypes by means of many-sorted signatures. In this process, we formalize our intuition that an indexed datatype is the combination of a data-structure and a data-logic. Over this abstraction of datatypes, we shall recast the definition of ornaments, effectively giving a model of ornaments. Benefiting both from the operational and abstract nature of many-sorted signatures, ornaments should appear applicable and, one hopes, of interest beyond the type-theoretic circles, case in point being languages with generalized abstract datatypes or refinement types.

Linked references
Hide All

This list contains references from the content that can be linked to their source. For a full set of references and notes please see the PDF or HTML where available.

R. Atkey , P. Johann & N. Ghani (2012) Refining inductive types. Log. Methods Comput. Sci. 8 (2), 130.

E. Brady (2013) Idris, a general-purpose dependently typed programming language: Design and implementation. J. Funct. Program. 23 (5), 552593.

P. Dybjer (1994) Inductive families. Form. Asp. Comput. 6 (4), 440465.

P. Dybjer (1997) Representing inductively defined sets by wellorderings in Martin-Löf's type theory. Theor. Comput. Sci. 176 (1–2), 329335.

N. Gambino & J. Kock (2013) Polynomial functors and polynomial monads. Math. Proc. Camb. Phil. Soc. 154 (1), 153192.

G. Huet (1997) The zipper. J. Funct. Program. 7 (05), 549554.

P. Morris , T. Altenkirch & N. Ghani (2009) A universe of strictly positive families. Int. J. Found. Comput. Sci. 20 (1), 83107.

C. Okasaki (1998) Purely Functional Data Structures. Cambridge University Press.

R. A. G. Seely (1983) Locally cartesian closed categories and type theory. Math. Proc. Camb. Phil. Soc. 95 (1), 3348.

Recommend this journal

Email your librarian or administrator to recommend adding this journal to your organisation's collection.

Journal of Functional Programming
  • ISSN: 0956-7968
  • EISSN: 1469-7653
  • URL: /core/journals/journal-of-functional-programming
Please enter your name
Please enter a valid email address
Who would you like to send this to? *


Full text views

Total number of HTML views: 0
Total number of PDF views: 50 *
Loading metrics...

Abstract views

Total abstract views: 428 *
Loading metrics...

* Views captured on Cambridge Core between 6th February 2017 - 23rd August 2017. This data will be updated every 24 hours.