Datatype unification using Monoids

How to infer the types of plain data, including unification