public static ListMonad <TOut> ConcatMap <TIn, TOut>(this ListMonad <TIn> m, Func <TIn, TOut> func) { ListMonad <TOut> output = ListMonad.Return(new List <TOut>()); if (m.Values != null && m.Values.Any()) { foreach (TIn item in m.Values) { TOut temp = func(item); output.Values.Add(temp); } } return(output); }
static void Main(string[] args) { // Bind Example IdentityMonad.BindExample(); // Select Many Example IdentityMonad.SelectManyExample(); // LINQ Example IdentityMonad.LinqExample(); // Maybe Monad Example MaybeMonad.LinqExample(); // List Monad Example ListMonad.LinqExample(); // Continuation Monad Example ContinuationMonad.LinqExample(); // Async Computation Example AsyncComputationExample.LinqExample(); }
public void TestWrap() { var s = ListMonad.Wrap("test"); s.Single().AssertEquals("test"); }
public C(ListMonad<long> m) { this.m = m; }
public C(ListMonad <long> m) { this.m = m; }