Compare commits
2 Commits
115d6766a5
...
92507c8c06
Author | SHA1 | Date |
---|---|---|
Sanchime | 92507c8c06 | |
Sanchime | 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();
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
namespace Sanchime.Functional.Core.Products;
|
||||
|
||||
/// <summary>
|
||||
/// 单位元
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <returns></returns>
|
||||
public delegate T Identity<T>();
|
Loading…
Reference in New Issue