-
Notifications
You must be signed in to change notification settings - Fork 15
PipeOperators
David Arno edited this page Feb 17, 2020
·
2 revisions
Consider the following sentence:
Pass the number, one, into function, f, then pass the result to function, g.
Normally, in C#, we must write this back to front, in the following form:
g(f(1));
The idea of the forward pipe operator, is that it allows the above to be written in code in the same way that it would be expressed in English. Using F# notation, this would be:
1 |> f |> g
C# doesn't support defining new operators, so Succinc<T> implements this with the Into
extension method, in SuccincT.Functional.PipeExtensions
. So the above code can now be written as:
1.Into(f).Into(g);
Action
/Func
conversionsCycle
methods- Converting between
Action
andFunc
- Extension methods for existing types that use
Option<T>
- Indexed enumerations
IEnumerable<T>
cons- Option-based parsers
- Partial function applications
- Pattern matching
- Pipe Operators
- Typed lambdas
Any
Either<TLeft,TRight>
None
Option<T>
Success<T>
Union<T1,T2>
Union<T1,T2,T3>
Union<T1,T2,T3,T4>
Unit
ValueOrError