为Identity添加扩展
This commit is contained in:
parent
115d6766a5
commit
df4e7eea7e
|
@ -0,0 +1,12 @@
|
||||||
|
using Sanchime.Functional.Core.Products;
|
||||||
|
|
||||||
|
namespace Sanchime.Functional.Core.Extensions;
|
||||||
|
|
||||||
|
public static class IdentityExtension
|
||||||
|
{
|
||||||
|
public static Identity<R> Map<T, R>(this Identity<T> @this, Func<T, R> mapping)
|
||||||
|
=> () => mapping(@this());
|
||||||
|
|
||||||
|
public static Identity<R> Bind<T, R>(this Identity<T> @this, Func<T, Identity<R>> binding)
|
||||||
|
=> binding(@this()).Invoke();
|
||||||
|
}
|
Loading…
Reference in New Issue