Ryan Benasutti
09/27/2019, 8:30 PMStackOverflowError
sometimes because my `bind()`'s inside fx.monad
go pretty deep (too deep, apparently). Are there any simple ways to restructure my code to work around this, or do I just need to rewrite it differently? This usually works fine as a quick way to do validation, but it seems to break down at large scales.
fun <F> MonadError<F, String>.layerGraphIsValid(
layerGraph: Graph<SealedLayer.MetaLayer>
): Kind<F, Unit> =
fx.monad {
layerNamesAreUnique(layerGraph).bind()
layerGraph.nodes().forEach {
hasInputs(it).bind()
inputsAreDeclared(layerGraph, it).bind()
}
}