public IEnumerable <A> AsEnumerable() { IEnumerable <A> Yield() { var self = this; while (self.Count != 0) { yield return(self.value); self = self.tail; } } return(Prelude.toSeq(Yield())); }
public static Seq <B> rights <CHOICE, CH, A, B>(Seq <CH> ma) where CHOICE : struct, Choice <CH, A, B> { var lst = new List <B>(); foreach (var item in ma) { if (default(CHOICE).IsRight(item)) { lst.Add(default(CHOICE).Match( item, Left: x => default(B), Right: y => y, Bottom: () => default(B))); } } return(Prelude.toSeq(lst)); }
public static Seq <B> rights <CHOICE, CH, A, B>(Seq <CH> ma) where CHOICE : struct, ChoiceUnsafe <CH, A, B> => Prelude.toSeq(rights <CHOICE, CH, A, B>(ma.AsEnumerable()));
public static async Task <Seq <B> > rightsAsync <CHOICE, CH, A, B>(Seq <CH> ma) where CHOICE : struct, ChoiceAsync <CH, A, B> => Prelude.toSeq(await rightsAsync <CHOICE, CH, A, B>(ma.AsEnumerable()).ConfigureAwait(false));
public Seq <A> ToSeq() => Prelude.toSeq(AsEnumerable());
public static async Task <Seq <A> > leftsUnsafeAsync <CHOICE, CH, A, B>(Seq <CH> ma) where CHOICE : struct, ChoiceUnsafeAsync <CH, A, B> => Prelude.toSeq(await leftsUnsafeAsync <CHOICE, CH, A, B>(ma.AsEnumerable()).ConfigureAwait(false));