I am using lauthy language ext in c# here are 3 functions those will be called in form main function the aim is return aggregated results of commands.. or Error but it is complinign below when I pass y to ExecuteSingleHostCommands
Error CS1503 Argument 1: cannot convert from 'System.Func>' to 'System.Func>' 03'
Returns Fun for given command
executes fun with param and return results or error
validates and return error in fails -- Main func -executes one by one command and bails out if any command is bad one.. if all goes well return aggregated resultsof all commands
internal static Func> GetSingleCommands( IDictionary>> commandMap, Command hostCommand) => commandMap.Where(command => command.Key == hostCommand.Name).Select(keyValuePairs => keyValuePairs.Value).FirstOrDefault();
internal static EitherAsync> ExecuteSingleCommands( Func> commands, string hostCommand) => new List>> { commands }.Aggregate( Right>(ImmutableList.Empty).ToAsync(), (state, func) => state.Bind(response => func(hostCommand).Map(response.Add)));
internal static Either<Error, Unit> Validate(string hostCommand) => CommandMap.Find(command => command.Key == hostCommand).IsSome ? Right(Unit.Default) : Left<Error, Unit>(new Error()); public static EitherAsync<Error, ImmutableList<Response>> ExecuteAllAsync( IDictionary<string, Func<string, EitherAsync<Error, HostResponse>>> commandMap, IList<Command> hostCommands) => from hostCommand in hostCommands from x in Command.Validate(hostCommand.Name) let y = Command.GetSingleHostCommands(commandMap, hostCommand).ToAsync() select Command.ExecuteSingleHostCommands(y, hostCommand.jobName);