Example #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()));
        }
Example #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));
Example #3
0
 [PublicAPI] public static A head <A>(this NonEmpty <List <A> > ne) => ne.a[0];
Example #4
0
 [PublicAPI] public static A head <A>(this NonEmpty <A[]> ne) => ne.a[0];
Example #5
0
 [PublicAPI] public static A head <A>(this NonEmpty <ImmutableArray <A> > ne) => ne.a[0];
Example #6
0
 public static NonEmpty <ImmutableSortedSet <A> > sortedSet <A>(A a1, params A[] rest) =>
 NonEmpty <ImmutableSortedSet <A> > .__unsafeNew(ImmutableSortedSet.Create(rest).Add(a1));
Example #7
0
 public static NonEmpty <ImmutableSortedSet <A> > sortedSet <A>(A a1) =>
 NonEmpty <ImmutableSortedSet <A> > .__unsafeNew(ImmutableSortedSet.Create(a1));
Example #8
0
 public static NonEmpty <IEnumerable <B> > map <A, B>(this NonEmpty <A[]> ne, Func <A, B> f) =>
 map <A, B, A[]>(ne, f);
Example #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));
Example #10
0
 public static NonEmpty <ImmutableArray <A> > array <A>(A a1) =>
 NonEmpty <ImmutableArray <A> > .__unsafeNew(ImmutableArray.Create(a1));
Example #11
0
 public static Option <NonEmpty <ImmutableSortedSet <A> > > toNonEmpty <A>(this ImmutableSortedSet <A> c) =>
 NonEmpty <ImmutableSortedSet <A> > .__unsafeApply(c, _ => _.IsEmpty);
Example #12
0
 public static Option <NonEmpty <List <A> > > toNonEmpty <A>(this List <A> c) =>
 NonEmpty <List <A> > .__unsafeApply(c, _ => _.isEmpty());
Example #13
0
 public static Option <NonEmpty <A[]> > toNonEmpty <A>(this A[] c) =>
 NonEmpty <A[]> .__unsafeApply(c, _ => _.isEmpty());
Example #14
0
 public static NonEmpty <ImmutableSortedSet <A> > ToImmutableSortedSet <A>(this NonEmpty <IEnumerable <A> > ne) =>
 NonEmpty <ImmutableSortedSet <A> > .__unsafeNew(ne.a.ToImmutableSortedSet());
Example #15
0
 public static NonEmpty <ImmutableArray <A> > ToImmutableArray <A>(this NonEmpty <IEnumerable <A> > ne) =>
 NonEmpty <ImmutableArray <A> > .__unsafeNew(ne.a.ToImmutableArray());
Example #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);
Example #17
0
 public static NonEmpty <ImmutableList <A> > toImmutableList <A>(this NonEmpty <IEnumerable <A> > ne) =>
 NonEmpty <ImmutableList <A> > .__unsafeNew(ne.a.ToImmutableList());
Example #18
0
 public static A head <A>(this NonEmpty <ImmutableList <A> > ne) => ne.a[0];