Summary: Haskell Examples for Iteration and Coiteration
on Higher-Order Datatypes
Theoretical Computer Science, University of Munich
January 31, 2003
This document gives a Haskell implementations of the examples in the article It-
eration and Coiteration for Higher-Order Nested Datatypes by Abel and Matthes
[AM03]. The programs make essential use of the rank-2 extensions of Haskell
98 and can be run under hugs -98 or compiled with ghc -fglasgow-exts.
Thanks to Ralph Hinze who provided lhs2TeX which was used to type-set
the literate Haskell sources automatically.
1 (Co)inductive types
module Rank1 where
data Mu1 f = In1 (f (Mu1 f ))
it1 :: Functor f (f a a) Mu1 f a
it1 s (In1 t) = s (fmap (it1 s ) t)
data Nu1 f = forall a. Coit1 (a f a) a