Many algorithms have to be implemented over and over again for different datatypes, either because datatypes change during the development of programs, or because the same algorithm is used for several datatypes. Examples of such algorithms are equality tests, pretty printers, and pattern matchers, and polytypic programming is a paradigm for expressing such algorithms. This dissertation introduces polytypic programming for functional programming languages, shows how to construct and prove properties of polytypic algorithms, presents the language extension PolyP for implementing polytypic algorithms in a type safe way, and presents a number of applications of polytypic programming. The applications include a library of basic polytypic buildi...