User defined datatypes

Dummy PR so I can comment on this branch.
We may also want to keep a `TypeTag` here.  Though we will probably have to be careful to avoid problems with serialization.