Iteration and coiteration schemes for higher-order and nested datatypes
This article studies the implementation of inductive and coinductive constructors of higher kinds (higher-order nested datatypes) in typed term rewriting, with emphasis on the choice of the iteration and coiteration constructions to support as primitive. We propose and compare several well-behaved extensions of System F-omega with some form of iteration and coiteration uniform in all kinds. In what we call Mendler-style systems, the iterator and coiterator have a computational behavior similar to the General recursor, but their types guarantee termination. In conventional-style systems, monotonicity witnesses are used for a notion of monotonicity defined uniformly for all kinds. Our most expressive systems GMIt(omega) and GIt(omega) of generalized Mendler, resp. conventional (co)iteration encompass Martin, Gibbons and Bailey's efficient folds for rank-2 inductive types. Strong normalization of all systems considered is proved by providing an embedding of the basic Mendler-style system MIt(omega) into System F-omega. (c) 2004 Elsevier B.V. All rights reserved.
iteration coiteration efficient folds strong normalization higher-order datatypes generalized folds system f omega higher-order polymorphism