errorsObject' :: Id -> [Id] -> [Element] -> [String]
errorsObject' n args elems = catMaybes [e1, e2, e3]
    where
      e1 | not . null $ dupLocs =
           Just $
             printf "Object %s: locations must be exclusive, but: %s" n (show dupLocs)
         | otherwise = Nothing
      e2 | not . null $ dupArgs =
           Just $
             printf "Object %s: arguments must be exclusive, but: %s" n (show dupArgs)
         | otherwise = Nothing
      e3 | not . null $ dupArgLocs =
           Just $
             printf "Object %s: locations and arguments must be exclusive, but: %s" n (show dupArgLocs)
         | otherwise = Nothing
      argFreq = freqMap args
      locFreq = locationsOccursionElements elems
      dupArgs = M.elems . M.filter (> 1) $ argFreq
      dupLocs = M.elems . M.filter (> 1) $ locFreq
      dupArgLocs = M.elems . M.filter (> 1) $ M.unionWith (+) argFreq locFreq
errorsObject' :: Id -> [Id] -> [Element] -> [String]
errorsObject' n args elems = catMaybes [e1, e2, e3]
    where
      e1 | not . null $ dupLocs =
           Just $
             printf "Object %s: locations must be exclusive, but: %s" n (show dupLocs)
         | otherwise = Nothing
      e2 | not . null $ dupArgs =
           Just $
             printf "Object %s: arguments must be exclusive, but: %s" n (show dupArgs)
         | otherwise = Nothing
      e3 | not . null $ dupArgLocs =
           Just $
             printf "Object %s: locations and arguments must be exclusive, but: %s" n (show dupArgLocs)
         | otherwise = Nothing
      argFreq = freqMap args
      locFreq = locationsOccursionElements elems
      dupArgs = M.elems . M.filter (> 1) $ argFreq
      dupLocs = M.elems . M.filter (> 1) $ locFreq
      dupArgLocs = M.elems . M.filter (> 1) $ M.unionWith (+) argFreq locFreq
errorsObject' n args elems = catMaybes [e1, e2, e3]
    where
      e1 | not . null $ dupLocs =
           Just $
             printf "Object %s: locations must be exclusive, but: %s" n (show dupLocs)
         | otherwise = Nothing
      e2 | not . null $ dupArgs =
           Just $
             printf "Object %s: arguments must be exclusive, but: %s" n (show dupArgs)
         | otherwise = Nothing
      e3 | not . null $ dupArgLocs =
           Just $
             printf "Object %s: locations and arguments must be exclusive, but: %s" n (show dupArgLocs)
         | otherwise = Nothing
      argFreq = freqMap args
      locFreq = locationsOccursionElements elems
      dupArgs = M.elems . M.filter (> 1) $ argFreq
      dupLocs = M.elems . M.filter (> 1) $ locFreq
      dupArgLocs = M.elems . M.filter (> 1) $ M.unionWith (+) argFreq locFreq