private static Either <Error, Unit> Loop() { EmployeeAppHelpers.PrintWelcomeMessage(); return(ReadAction() .Bind(action => EmployeeApp.Run(action) ) .Match( Right: _ => RetryPrompt(), Left: error => { Console.WriteLine("Error: " + error.Message); return RetryPrompt(); } )); //return ( // from action in ReadAction() // from result in EmployeeApp.Run(action) // select result //).Match( // Right: _ => RetryPrompt(), // Left: error => // { // Console.WriteLine("Error: " + error.Message); // return RetryPrompt(); // } //); }
private static void Loop() { EmployeeAppHelpers.PrintWelcomeMessage(); var action = Enum.Parse <UserAction>(Console.ReadLine()); EmployeeApp.Run(action); RetryPrompt(); }
private static Option <Unit> Loop() { EmployeeAppHelpers.PrintWelcomeMessage(); return(ReadAction() .Bind((action) => EmployeeApp.Run(action)) .Match( Some: _ => RetryPrompt(), None: () => { Console.WriteLine("Error occured!"); return RetryPrompt(); } )); }