countWords :: Ord a => [a] -> Map.Map a Int
countWords ws = foldl addOccurance Map.empty ws where
  addOccurance m word = Map.insert word (count + 1) m where
    count | Map.member word m = m Map.! word
          | otherwise = 0
countWords :: Ord a => [a] -> Map.Map a Int
countWords ws = foldl addOccurance Map.empty ws where
  addOccurance m word = Map.insert word (count + 1) m where
    count | Map.member word m = m Map.! word
          | otherwise = 0
countWords ws = foldl addOccurance Map.empty ws where
  addOccurance m word = Map.insert word (count + 1) m where
    count | Map.member word m = m Map.! word
          | otherwise = 0