+ -- | Compare two 'DomainCount's by the length of their domain. The
+ -- one with the longest domain is \"bigger\".
+ compare_dcs_by_length :: DomainCount -> DomainCount -> Ordering
+ compare_dcs_by_length (DomainCount x _) (DomainCount y _) =
+ compare (length x) (length y)
+
+ -- | Find the length of the 'DomainCount' in the list that has the
+ -- longest domain. We need to know this in order to pad the
+ -- counts on the left by the correct number of spaces.
+ longest_dc_length :: [DomainCount] -> Int
+ longest_dc_length dcs =
+ let (DomainCount d _) = longest in length d
+ where
+ longest = maximumBy compare_dcs_by_length dcs
+