Exemplo n.º 1
0
        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()));
        }
Exemplo n.º 2
0
        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));
        }
Exemplo n.º 3
0
 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));
Exemplo n.º 5
0
 public Seq <A> ToSeq() =>
 Prelude.toSeq(AsEnumerable());
Exemplo n.º 6
0
 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));