Given an event union, build a Record mapping each event to a handler function with the right payload type.