static Nullable<double> SafeLog(int x)
{
return x > 0 ? new Nullable<double>(Math.Log(x)) : new Nullable<double>();
}


    static Nullable<R> ApplySpecialFunction<A, R>(Nullable<A> nullable, Func<A, Nullable<R>> function)
{
if (nullable.HasValue)
{
A unwrapped = nullable.Value;
Nullable<R> result = function(unwrapped);
return result;
}
else
{
return new Nullable<R>();
}
}


    static OnDemand<R> ApplySpecialFunction<A, R>(OnDemand<A> onDemand, Func<A, OnDemand<R>> function)
{
return () =>
{
A unwrapped = onDemand();
OnDemand<R> result = function(unwrapped);
return result();
}
}


    static Lazy<R> ApplySpecialFunction<A, R>(Lazy<A> lazy, Func<A, Lazy<R>> function)
{
return new Lazy(() =>
{
A unwrapped = lazy.Value;
Lazy<R> result = function(unwrapped);
return result.Value;
};
}

{
return await result;
}


    static IEnumerable<R> ApplySpecialFunction<A, R>(IEnumerable<A> sequence, Func<A, IEnumerable<R>> function)
{
foreach(A unwrapped in sequence)
{
IEnumerable<R> result = function(unwrapped);
foreach(R r in result)
yield return r;
}
}


### 总结

#### 第一原则

    static Monadic<T> CreateSimpleMonadic<T>(T value)


#### 第二原则

    static Monadic<R> ApplyFunction<A, R>(Monadic<A> wrapped, Func<A, R> function)


#### 第三原则

    static Monadic<R> ApplySpecialFunction<A, R>(Monadic<A> wrapped, Func<A, Monadic<R>> function)


    static Monadic<R> ApplyFunction<A, R>(Monadic<A> wrapped, Func<A, R> function)
{
return ApplySpecialFunction<A, R>(wrapped, unwrapped => CreateSimpleMonadic(function(unwrapped)));
}


#### 第一原则

    static Monadic<T> CreateSimpleMonadic<T>(T value)


#### 第二原则

    static Monadic<T> ApplySpecialFunction<A, R>(Monadic<A> wrapped, Func<A, Monadic<R>> function)


1. 取出被Monadic<A>包装的一系列值
2. 通过某些方法将这一系列值组合包装为一个单独的Monadic<R>

E ti amerò comunque lo so, anche se non sei con me