louthy / language-ext

C# functional language extensions - a base class library for functional programming
MIT License
6.39k stars 414 forks source link

Duplicate MatchAsync extension methods on Task<TryOption> #1212

Open fuzzlebuck opened 1 year ago

fuzzlebuck commented 1 year ago

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.

louthy commented 1 year ago

I feel a PR in your future ;-)

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

fuzzlebuck commented 1 year ago

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

Laptop765 commented 1 year ago

I think this also applies to OptionAsync.Extensions.

image