@Override
    public ConfigExpression<I, O> simplifyOnce() {
      return switch (children.size()) {
        case 0 -> constOf(null);
        case 1 -> children.getFirst();
        default -> {
          var result = children.stream()
            .flatMap(
              child -> child instanceof Coalesce<?, ?> childCoalesce ? childCoalesce.children.stream() :
                Stream.of(child))
            .filter(child -> !child.equals(constOf(null)))
            .distinct()
            .toList();
          var indexOfFirstConst = result.stream().takeWhile(d -> !(d instanceof ConfigExpression.Const<?, ?>)).count();
          yield coalesce(result.stream().map(d -> {
            @SuppressWarnings("unchecked") ConfigExpression<I, O> casted = (ConfigExpression<I, O>) d;
            return casted;
          }).limit(indexOfFirstConst + 1).toList());
        }
      };
    }
An expression that returns the first non-null result of evaluating each child expression.
planetiler-custommap/src/main/java/com/onthegomap/planetiler/custommap/expression/ConfigExpression.java