diff --git a/Sanchime.Functional/Core/Extensions/Nullable.cs b/Sanchime.Functional/Core/Extensions/Nullable.cs
new file mode 100644
index 0000000..c07d35c
--- /dev/null
+++ b/Sanchime.Functional/Core/Extensions/Nullable.cs
@@ -0,0 +1,12 @@
+using Sanchime.Functional.Core.Products;
+
+namespace Sanchime.Functional.Core.Extensions;
+
+public static class NullableExtension
+{
+ ///
+ /// 将值转换为
+ ///
+ public static Option ToOption(this Nullable @this) where T : struct
+ => @this.HasValue ? Option.Some(@this.Value) : Option.None;
+}
diff --git a/Sanchime.Functional/Core/Products/IApplicative.cs b/Sanchime.Functional/Core/Products/IApplicative.cs
new file mode 100644
index 0000000..e46f4e1
--- /dev/null
+++ b/Sanchime.Functional/Core/Products/IApplicative.cs
@@ -0,0 +1,9 @@
+namespace Sanchime.Functional.Core.Products;
+
+///
+/// 应用函子
+///
+///
+public interface IApplicative : IFunctor
+{
+}
diff --git a/Sanchime.Functional/Core/Products/IFunctor.cs b/Sanchime.Functional/Core/Products/IFunctor.cs
index 1b81561..4fc6a57 100644
--- a/Sanchime.Functional/Core/Products/IFunctor.cs
+++ b/Sanchime.Functional/Core/Products/IFunctor.cs
@@ -7,5 +7,15 @@ namespace Sanchime.Functional.Core.Products;
///
public interface IFunctor : ICategory
{
- IFunctor Map(Func> mapping);
+ TCategory Map(Func mapping);
+}
+
+
+public struct Test : IFunctor>
+{
+ public T? Value {get; set; }
+ public Test Map(Func, Test> mapping)
+ {
+ return mapping(this);
+ }
}
diff --git a/Sanchime.Functional/Core/Products/IMonad.cs b/Sanchime.Functional/Core/Products/IMonad.cs
new file mode 100644
index 0000000..47fbd56
--- /dev/null
+++ b/Sanchime.Functional/Core/Products/IMonad.cs
@@ -0,0 +1,9 @@
+namespace Sanchime.Functional.Core.Products;
+
+///
+/// 单子
+///
+///
+public interface IMonad : IApplicative
+{
+}
diff --git a/Sanchime.sln b/Sanchime.sln
index fecf226..7052d2a 100644
--- a/Sanchime.sln
+++ b/Sanchime.sln
@@ -7,6 +7,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sanchime.Test", "Sanchime.T
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sanchime.Functional", "Sanchime.Functional\Sanchime.Functional.csproj", "{DF48AFE2-CD1B-4BCE-83EF-DA8BDA104069}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sanchime.Toolkits", "Sanchime.Toolkits\Sanchime.Toolkits.csproj", "{3A94EB2F-04F1-46F8-ADD8-DE091402635F}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -24,5 +26,9 @@ Global
{DF48AFE2-CD1B-4BCE-83EF-DA8BDA104069}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DF48AFE2-CD1B-4BCE-83EF-DA8BDA104069}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DF48AFE2-CD1B-4BCE-83EF-DA8BDA104069}.Release|Any CPU.Build.0 = Release|Any CPU
+ {3A94EB2F-04F1-46F8-ADD8-DE091402635F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {3A94EB2F-04F1-46F8-ADD8-DE091402635F}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {3A94EB2F-04F1-46F8-ADD8-DE091402635F}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {3A94EB2F-04F1-46F8-ADD8-DE091402635F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal