refSingleton' is an instance that appears by itself in a 'RefGroup'
--   without other items or constraints that imply that there could be other
--   items
refSingleton :: RefGroup -> Maybe RefKey
refSingleton (RefGroup c is bnds) =
    case Set.toList is of
        [i] -> if kosher bnds then Just (c,i) else Nothing
        _   -> Nothing
  where
    -- either no bounds information, or “exactly 1" are acceptable
    kosher (Bounds [] Nothing Nothing)   = True
    kosher (Bounds [] (Just 1) (Just 1)) = True
    kosher _ = False

-- | If a RefGroup has explicit constraints, augment them with the
--   implicit constraints that arise from treating each item
--   as evidence of an at least constraint
--
--   It's a good idea to run this once when building 'RefGroup's,
--   but you may also decide that this sort of behaviour is not
--   desirable for your application, so it's off by default
noteImpli
refSingleton :: RefGroup -> Maybe RefKey
refSingleton (RefGroup c is bnds) =
    case Set.toList is of
        [i] -> if kosher bnds then Just (c,i) else Nothing
        _   -> Nothing
  where
    -- either no bounds information, or “exactly 1" are acceptable
    kosher (Bounds [] Nothing Nothing)   = True
    kosher (Bounds [] (Just 1) (Just 1)) = True
    kosher _ = False

-- | If a RefGroup has explicit constraints, augment them with the
--   implicit constraints that arise from treating each item
--   as evidence of an at least constraint
--
--   It's a good idea to run this once when building 'RefGroup's,
--   but you may also decide that this sort of behaviour is not
--   desirable for your application, so it's off by default
refSingleton (RefGroup c is bnds) =
    case Set.toList is of
        [i] -> if kosher bnds then Just (c,i) else Nothing
        _   -> Nothing
  where
    -- either no bounds information, or “exactly 1" are acceptable
    kosher (Bounds [] Nothing Nothing)   = True
    kosher (Bounds [] (Just 1) (Just 1)) = True
    kosher _ = False

-- | If a RefGroup has explicit constraints, augment them with the
--   implicit constraints that arise from treating each item
--   as evidence of an at least constraint
--
--   It's a good idea to run this once when building 'RefGroup's,
--   but you may also decide that this sort of behaviour is not
--   desirable for your application, so it's off by default