I want to try to write a DSL, which can launch multiple methods piped one after the other to give an end result of a specific type, lets call it “Result”. The intermediate results of each of the calls can have different types, lets call them for example “Type 1", “Type 2” etc. I tried to accomplish something like this with following code. The pipeline should be able to execute multiple steps concurrently as well and combine the results in a combined result. When calling execute, you should execute the entire pipeline and then get an end result:
But i get Type errros when calling the addStep functions. How could I make this work?