generic mux using sum constructor