make two functions here:

// one node, NOT recursive through dependencies
def mergableWithSource(dep: Prod[_]): Boolean
def allDepsMergeableWithSource(d) = mergebaleWithSource(p) && Producer.dependencies(p).forall(allDepsMergeableWithSource)

Thes you can use the one step version below where you ask if outerProducer is mergable with source.