code: public static List<Type> baseTypes(List<Type> ts) {
          if (ts.nonEmpty()) {
              Type t = ts.head.baseType();
              List<Type> baseTypes = baseTypes(ts.tail);
              if (t != ts.head || baseTypes != ts.tail)
                  return baseTypes.prepend(t);
          }
          return ts;
      }
docs: Return the base types of a list of types.