language-ext icon indicating copy to clipboard operation
language-ext copied to clipboard

Duplicate MatchAsync extension methods on Task<TryOption>

Open fuzzlebuck opened this issue 1 year ago • 3 comments

Hey,

Having some trouble with what looks to be a duplicate extension method which results in:

The call is ambiguous between the following methods or properties: 'TaskTryOptionExtensions.MatchAsync<A, R>(Task<TryOption<A>>, Func<A, Task<R>>, Func<R>, Func<Exception, R>)' and 'TryOptionExtensions.MatchAsync<T, R>(Task<TryOption<T>>, Func<T, Task<R>>, Func<R>, Func<Exception, R>)'

They have the same signature so I can't use named params to specify which one.

The offending extensions are:

https://github.com/louthy/language-ext/blob/437171250d26a5b26c516b7c0ca94ebeb67da2b6/LanguageExt.Core/Monads/Alternative%20Value%20Monads/Try/TryOption/Task.TryOption.Extensions.cs#L215

https://github.com/louthy/language-ext/blob/437171250d26a5b26c516b7c0ca94ebeb67da2b6/LanguageExt.Core/Monads/Alternative%20Value%20Monads/Try/TryOption/TryOption.Extensions.cs#L952

Cheers.

fuzzlebuck avatar Mar 19 '23 05:03 fuzzlebuck

I feel a PR in your future ;-)

If you could check that the other overloads don't double up that'd be very appreciated 👍

louthy avatar Mar 19 '23 09:03 louthy

Found 5 in total, removed the TryOption.Extensions version as the Task.TryOption.Extensions appear more well rounded and commented, hopefully this was the ideal solution, cheers.

PR: https://github.com/louthy/language-ext/pull/1213

fuzzlebuck avatar Mar 21 '23 08:03 fuzzlebuck

I think this also applies to OptionAsync.Extensions.

image

Laptop765 avatar Apr 11 '23 03:04 Laptop765