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