Skip to main content
edited body
Source Link
Yatrix
  • 335
  • 2
  • 10
 public static Func<string, Task<T>> MyMethod<T>( SAKACredentialsUserCredentials credentials, Func<string, string, string, Task<T>> func ) => async (value) => await func(credentials.user, credentials.pwd, value); 

I'm having difficulty discerning the purity of the function, because obviously T(int) results in a different output as T(string). Or does the purity depend on T(int) = 5 always resulting in 10 and T(string) = "Foo" always resulting in "Bar"?

 public static Func<string, Task<T>> MyMethod<T>( SAKACredentials credentials, Func<string, string, string, Task<T>> func ) => async (value) => await func(credentials.user, credentials.pwd, value); 

I'm having difficulty discerning the purity of the function, because obviously T(int) results in a different output as T(string). Or does the purity depend on T(int) = 5 always resulting in 10 and T(string) = "Foo" always resulting in "Bar"?

 public static Func<string, Task<T>> MyMethod<T>( UserCredentials credentials, Func<string, string, string, Task<T>> func ) => async (value) => await func(credentials.user, credentials.pwd, value); 

I'm having difficulty discerning the purity of the function, because obviously T(int) results in a different output as T(string). Or does the purity depend on T(int) = 5 always resulting in 10 and T(string) = "Foo" always resulting in "Bar"?

Source Link
Yatrix
  • 335
  • 2
  • 10

Functional programming: does using a generic make a function impure?

 public static Func<string, Task<T>> MyMethod<T>( SAKACredentials credentials, Func<string, string, string, Task<T>> func ) => async (value) => await func(credentials.user, credentials.pwd, value); 

I'm having difficulty discerning the purity of the function, because obviously T(int) results in a different output as T(string). Or does the purity depend on T(int) = 5 always resulting in 10 and T(string) = "Foo" always resulting in "Bar"?