mo icon indicating copy to clipboard operation
mo copied to clipboard

Could we add EitherX ?

Open CorentinClabaut opened this issue 3 years ago • 0 comments

I guess we could have:

type Either3[T1 any, T2 any, T3 any] struct {
	argId int

	arg1 T1
	arg2 T2
	arg3 T3
}

Constructors:

mo.CreateEither3Arg1() mo.CreateEither3Arg2() mo.CreateEither3Arg3()

Methods:

.IsArg(i int) .Arg1() .Arg2() .Arg3() .MustArg1() .MustArg2() .MustArg3() .Arg1OrElse() .Arg2OrElse() .Arg3OrElse() .Arg1OrEmpty() .Arg2OrEmpty() .Arg3OrEmpty() .ForEach() .Match() .MapArg1() .MapArg2() .MapArg3()

@samber If you agree that it could be useful I could add Either3/4/5 If this is added I'm wondering if we should then have Either2 instead of the current Either type for consistency? And maybe mark the current Either as deprecated?

CorentinClabaut avatar Aug 05 '22 07:08 CorentinClabaut