Generic level polymorphic N-ary functions

Allais, Guillaume (2019) Generic level polymorphic N-ary functions. In: TyDe 2019 - Proceedings of the 4th ACM SIGPLAN International Workshop on Type-Driven Development, co-located with ICFP 2019. ACM, New York, NY, New York, pp. 14-26. ISBN 9781450368155

[img]
Preview
Text (Allais-ACM-SIGPLAN-2019-Generic-level-polymorphic-N-ary)
Allais_ACM_SIGPLAN_2019_Generic_level_polymorphic_N_ary.pdf
Accepted Author Manuscript

Download (601kB)| Preview

    Abstract

    Agda's standard library struggles in various places with n-ary functions and relations. It introduces congruence and substitution operators for functions of arities one and two, and provides users with convenient combinators for manipulating indexed families of arity exactly one. After a careful analysis of the kinds of problems the unifier can easily solve, we design a unifier-friendly representation of n-ary functions. This allows us to write generic programs acting on n-ary functions which automatically reconstruct the representation of their inputs' types by unification. In particular, we can define fully level polymorphic n-ary versions of congruence, substitution and the combinators for indexed families, all requiring minimal user input.