Innovenergy_trunk/csharp/lib/Utils/PointFree.cs

21 lines
476 B
C#
Raw Normal View History

2023-02-16 12:57:06 +00:00
namespace InnovEnergy.Lib.Utils;
public static class PointFree
{
public static Action<T> Pipe<T, R>(this Func<T, R> inner, Action<R> outer)
{
return tx => outer(inner(tx));
}
public static Func<T, R2> Pipe<T, R1, R2>(this Func<T, R1> inner, Func<R1, R2> outer)
{
return tx => outer(inner(tx));
}
public static Func<R2> Pipe<R1, R2>(this Func<R1> inner, Func<R1, R2> outer)
{
return () => outer(inner());
}
}