Change doc generation types to be partial functions and reorganize package layout