Redesign the API to use function types

This is a fairly deep redesign that touches a lot of parts. There
was not a clear way to divide up the changes beyond what is done
here.
Add test types for creating cases

Adds the very basic Publisher and Subscriber types.