Solution (source code)

= Solution

One simple right-associated representation is

``
rep :: [a] -> CatList a
rep []     = Nil
rep (x:xs) = Cat (One x) (rep xs)
``

It constructs two <data constructors> per input element and one final `Nil`, so full construction takes \b[$\Theta(n+1)$ time] and produces $2n+1$ constructors. <Structural induction> shows that its denotation is the original <list>.