Пример #1
0
        public static NonEmpty <ImmutableArray <A> > array <A>(A first, params A[] rest)
        {
            var b = ImmutableArray.CreateBuilder <A>(rest.Length + 1);

            b.Add(first);
            b.AddRange(rest);
            return(NonEmpty <ImmutableArray <A> > .__unsafeNew(b.MoveToImmutable()));
        }
Пример #2
0
 public static NonEmpty <IEnumerable <B> > map <A, B, C>(
     this NonEmpty <C> ne, Func <A, B> f
     ) where C : IEnumerable <A> =>
 NonEmpty <IEnumerable <B> > .__unsafeNew(ne.a.Select(f));
Пример #3
0
 [PublicAPI] public static A head <A>(this NonEmpty <List <A> > ne) => ne.a[0];
Пример #4
0
 [PublicAPI] public static A head <A>(this NonEmpty <A[]> ne) => ne.a[0];
Пример #5
0
 [PublicAPI] public static A head <A>(this NonEmpty <ImmutableArray <A> > ne) => ne.a[0];
Пример #6
0
 public static NonEmpty <ImmutableSortedSet <A> > sortedSet <A>(A a1, params A[] rest) =>
 NonEmpty <ImmutableSortedSet <A> > .__unsafeNew(ImmutableSortedSet.Create(rest).Add(a1));
Пример #7
0
 public static NonEmpty <ImmutableSortedSet <A> > sortedSet <A>(A a1) =>
 NonEmpty <ImmutableSortedSet <A> > .__unsafeNew(ImmutableSortedSet.Create(a1));
Пример #8
0
 public static NonEmpty <IEnumerable <B> > map <A, B>(this NonEmpty <A[]> ne, Func <A, B> f) =>
 map <A, B, A[]>(ne, f);
Пример #9
0
 public static NonEmpty <ImmutableArray <A> > array <A>(A a1, A a2, A a3, A a4) =>
 NonEmpty <ImmutableArray <A> > .__unsafeNew(ImmutableArray.Create(a1, a2, a3, a4));
Пример #10
0
 public static NonEmpty <ImmutableArray <A> > array <A>(A a1) =>
 NonEmpty <ImmutableArray <A> > .__unsafeNew(ImmutableArray.Create(a1));
Пример #11
0
 public static Option <NonEmpty <ImmutableSortedSet <A> > > toNonEmpty <A>(this ImmutableSortedSet <A> c) =>
 NonEmpty <ImmutableSortedSet <A> > .__unsafeApply(c, _ => _.IsEmpty);
Пример #12
0
 public static Option <NonEmpty <List <A> > > toNonEmpty <A>(this List <A> c) =>
 NonEmpty <List <A> > .__unsafeApply(c, _ => _.isEmpty());
Пример #13
0
 public static Option <NonEmpty <A[]> > toNonEmpty <A>(this A[] c) =>
 NonEmpty <A[]> .__unsafeApply(c, _ => _.isEmpty());
Пример #14
0
 public static NonEmpty <ImmutableSortedSet <A> > ToImmutableSortedSet <A>(this NonEmpty <IEnumerable <A> > ne) =>
 NonEmpty <ImmutableSortedSet <A> > .__unsafeNew(ne.a.ToImmutableSortedSet());
Пример #15
0
 public static NonEmpty <ImmutableArray <A> > ToImmutableArray <A>(this NonEmpty <IEnumerable <A> > ne) =>
 NonEmpty <ImmutableArray <A> > .__unsafeNew(ne.a.ToImmutableArray());
Пример #16
0
 public static NonEmpty <IEnumerable <B> > map <A, B>(this NonEmpty <ImmutableList <A> > ne, Func <A, B> f) =>
 map <A, B, ImmutableList <A> >(ne, f);
Пример #17
0
 public static NonEmpty <ImmutableList <A> > toImmutableList <A>(this NonEmpty <IEnumerable <A> > ne) =>
 NonEmpty <ImmutableList <A> > .__unsafeNew(ne.a.ToImmutableList());
Пример #18
0
 public static A head <A>(this NonEmpty <ImmutableList <A> > ne) => ne.a[0];