-- | Just ignores those that somehow don't exist. The 'Job.Dependency' is a
-- reverse dependency; the name is the name of the dependant.
withDependents :: (TS m) => (Job.Dependency -> Job.Status -> m ()) -> Job.Name -> m ()
withDependents f = mapM_ go . toList <=< ES.getDependents
  where go (n, o) = mapM_ (f (Job.Dependency n o)) =<< ES.getJob n

-- | "Inform" a job that one of its dependencies has become 'Job.Available'.
withDependents :: (TS m) => (Job.Dependency -> Job.Status -> m ()) -> Job.Name -> m ()
withDependents f = mapM_ go . toList <=< ES.getDependents
  where go (n, o) = mapM_ (f (Job.Dependency n o)) =<< ES.getJob n

-- | "Inform" a job that one of its dependencies has become 'Job.Available'.
withDependents f = mapM_ go . toList <=< ES.getDependents
  where go (n, o) = mapM_ (f (Job.Dependency n o)) =<< ES.getJob n

-- | "Inform" a job that one of its dependencies has become 'Job.Available'.