        IR1.BindingDecl b -> Just (B b)
        IR1.TypeAnnDecl ta -> Just (TA ta)
        _ -> Nothing
   in checkConflicts path relevantDecls

declName :: BindingOrTypeAnn -> Id
declName = \case
  B (IR1.Binding _ name _) -> name
  TA (IR1.TypeAnn _ name _) -> name

checkConflicts :: FilePath -> [BindingOrTypeAnn] -> ValidationResult [SAError]
checkConflicts path decls = foldMap g $ foldr' f Map.empty decls
  where
    f decl = case decl of