 :: RefHistory -> RefKey -> Bool
isTheOther st (c,i) =
    any isBuddy $ Map.keys (rhCount st)
  where
    isBuddy (Node g2 []) | isExact g2 && c == rgClass g2 =
        -- the other instance was mentioned at least once
        case getBuddy (rgIdxes g2) of
          Just b  -> lastMentions st (mkSingletonDu (c,b)) >= 1
          Nothing -> False
    isBuddy _ = False
    -- only trigger this for classes where they've been exactly
    -- two instances ["the ant, the other ant" is fine, but
    -- "the ant, a second ant, the other ant" is confusing...
    -- which other ant?]
    getBuddy (Set.toList -> idx) | length idx == 2 =
         case delete i idx of
             [b] -> Just b -- must be *exactly* one other item
             _   -> Nothing
    getBuddy _ = Nothing

-- | Is the class itself, not any individual entity within that class
--   ie. “ants” instead of “an ant” or “some ants”
--
--   By convention, any group which containts no indices or constraints
--   is considered to be classwide.
isClasswide :: RefGro
isTheOther :: RefHistory -> RefKey -> Bool
isTheOther st (c,i) =
    any isBuddy $ Map.keys (rhCount st)
  where
    isBuddy (Node g2 []) | isExact g2 && c == rgClass g2 =
        -- the other instance was mentioned at least once
        case getBuddy (rgIdxes g2) of
          Just b  -> lastMentions st (mkSingletonDu (c,b)) >= 1
          Nothing -> False
    isBuddy _ = False
    -- only trigger this for classes where they've been exactly
    -- two instances ["the ant, the other ant" is fine, but
    -- "the ant, a second ant, the other ant" is confusing...
    -- which other ant?]
    getBuddy (Set.toList -> idx) | length idx == 2 =
         case delete i idx of
             [b] -> Just b -- must be *exactly* one other item
             _   -> Nothing
    getBuddy _ = Nothing

-- | Is the class itself, not any individual entity within that class
--   ie. “ants” instead of “an ant” or “some ants”
--
--   By convention, any group which containts no indices or constraints
--   is considered to be classwide.
isTheOther st (c,i) =
    any isBuddy $ Map.keys (rhCount st)
  where
    isBuddy (Node g2 []) | isExact g2 && c == rgClass g2 =
        -- the other instance was mentioned at least once
        case getBuddy (rgIdxes g2) of
          Just b  -> lastMentions st (mkSingletonDu (c,b)) >= 1
          Nothing -> False
    isBuddy _ = False
    -- only trigger this for classes where they've been exactly
    -- two instances ["the ant, the other ant" is fine, but
    -- "the ant, a second ant, the other ant" is confusing...
    -- which other ant?]
    getBuddy (Set.toList -> idx) | length idx == 2 =
         case delete i idx of
             [b] -> Just b -- must be *exactly* one other item
             _   -> Nothing
    getBuddy _ = Nothing

-- | Is the class itself, not any individual entity within that class
--   ie. “ants” instead of “an ant” or “some ants”
--
--   By convention, any group which containts no indices or constraints
--   is considered to be classwide.