-- No conflicts
reportConflictInstErr fam_inst (match1 : _)
  | FamInstMatch { fim_instance = conf_inst } <- match1
  , let sorted  = sortWith getSpan [fam_inst, conf_inst]
        fi1     = head sorted
        span    = coAxBranchSpan (coAxiomSingleBranch (famInstAxiom fi1))
  = setSrcSpan span $ addErr $
    hang (text "Conflicting family instance declarations:")
       2 (vcat [ pprCoAxBranchUser (coAxiomTyCon ax) (coAxiomSingleBranch ax)
               | fi <- sorted
               , let ax = famInstAxiom fi ])
 where
   getSpan = getSrcLoc . famInstAxiom
   -- The sortWith just arranges that instances are displayed in order
   -- of source location, which reduced wobbling in error messages,
   -- and is better for users
reportConflictInstErr fam_inst (match1 : _)
  | FamInstMatch { fim_instance = conf_inst } <- match1
  , let sorted  = sortWith getSpan [fam_inst, conf_inst]
        fi1     = head sorted
        span    = coAxBranchSpan (coAxiomSingleBranch (famInstAxiom fi1))
  = setSrcSpan span $ addErr $
    hang (text "Conflicting family instance declarations:")
       2 (vcat [ pprCoAxBranchUser (coAxiomTyCon ax) (coAxiomSingleBranch ax)
               | fi <- sorted
               , let ax = famInstAxiom fi ])
 where
   getSpan = getSrcLoc . famInstAxiom
   -- The sortWith just arranges that instances are displayed in order
   -- of source location, which reduced wobbling in error messages,
   -- and is better for users
reportConflictInstErr fam_inst (match1 : _)
  | FamInstMatch { fim_instance = conf_inst } <- match1
  , let sorted  = sortWith getSpan [fam_inst, conf_inst]
        fi1     = head sorted
        span    = coAxBranchSpan (coAxiomSingleBranch (famInstAxiom fi1))
  = setSrcSpan span $ addErr $
    hang (text "Conflicting family instance declarations:")
       2 (vcat [ pprCoAxBranchUser (coAxiomTyCon ax) (coAxiomSingleBranch ax)
               | fi <- sorted
               , let ax = famInstAxiom fi ])
 where
   getSpan = getSrcLoc . famInstAxiom
   -- The sortWith just arranges that instances are displayed in order
   -- of source location, which reduced wobbling in error messages,
   -- and is better for users