more generic comparator for Fns