[enhancement] replaced implementation of size with a foldMap using Sum Monoid