Skip to content

Commit 5f4fde8

Browse files
committed
NonEmpty[List|Seq] #if !NET45
1 parent f3ed1af commit 5f4fde8

2 files changed

Lines changed: 18 additions & 8 deletions

File tree

src/FSharpPlus/Data/NonEmptyList.fs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,7 @@ module NonEmptyList =
494494
let init (count: int) (initializer: int -> 'T) : NonEmptyList<'T> =
495495
Seq.init count initializer |> ofSeq
496496

497+
#if !NET45
497498
/// <summary>Inserts an element at the specified index.</summary>
498499
/// <param name="index">The index at which to insert the element.</param>
499500
/// <param name="value">The value to insert.</param>
@@ -509,6 +510,7 @@ module NonEmptyList =
509510
/// <returns>The result list.</returns>
510511
let insertManyAt (index: int) (values: seq<'T>) (list: NonEmptyList<'T>) : NonEmptyList<'T> =
511512
Seq.insertManyAt index values list |> ofSeq
513+
#endif
512514

513515
/// <summary>Returns the element at the specified index.</summary>
514516
/// <param name="index">The index of the element to retrieve.</param>
@@ -673,6 +675,7 @@ module NonEmptyList =
673675
let inline range (start: 'T) stop =
674676
create start (List.drop 1 [start..stop])
675677

678+
#if !NET45
676679
/// <summary>Removes the element at the specified index.</summary>
677680
/// <param name="index">The index of the element to remove.</param>
678681
/// <param name="list">The input list.</param>
@@ -704,7 +707,8 @@ module NonEmptyList =
704707
/// <exception cref="System.ArgumentException">Thrown when removing the items results in an empty list.</exception>
705708
let removeManyAt (index: int) (count: int) (list: NonEmptyList<'T>) : NonEmptyList<'T> =
706709
list |> Seq.removeManyAt index count |> ofSeq
707-
710+
#endif
711+
708712
/// <summary>Creates a list that contains one repeated value.</summary>
709713
/// <param name="count">The number of elements.</param>
710714
/// <param name="value">The value to replicate.</param>
@@ -946,15 +950,17 @@ module NonEmptyList =
946950
/// <returns>A tuple containing the three lists.</returns>
947951
let unzip3 (list: NonEmptyList<'T1 * 'T2 * 'T3>) : NonEmptyList<'T1> * NonEmptyList<'T2> * NonEmptyList<'T3> =
948952
list |> toList |> List.unzip3 |> fun (a, b, c) -> (ofList a, ofList b, ofList c)
949-
953+
954+
#if !NET45
950955
/// <summary>Updates the element at the specified index.</summary>
951956
/// <param name="index">The index of the element to update.</param>
952957
/// <param name="value">The new value.</param>
953958
/// <param name="list">The input list.</param>
954959
/// <returns>The result list.</returns>
955960
let updateAt (index: int) (value: 'T) (list: NonEmptyList<'T>) : NonEmptyList<'T> =
956961
Seq.updateAt index value list |> ofSeq
957-
962+
#endif
963+
958964
/// <summary>Returns a list that contains the elements of the list for which the given function returns <c>true</c>.</summary>
959965
/// <param name="predicate">A function to test each element of the list.</param>
960966
/// <param name="list">The input list.</param>

src/FSharpPlus/Data/NonEmptySeq.fs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ module NonEmptySeq =
477477
/// <returns>The result sequence.</returns>
478478
let initInfinite initializer =
479479
Seq.initInfinite initializer |> unsafeOfSeq
480-
480+
#if !NET45
481481
/// <summary>Inserts an element at the specified index.</summary>
482482
/// <param name="index">The index at which to insert the element.</param>
483483
/// <param name="value">The value to insert.</param>
@@ -493,7 +493,7 @@ module NonEmptySeq =
493493
/// <returns>The result sequence.</returns>
494494
let insertManyAt (index: int) (values: seq<'T>) (source: NonEmptySeq<'T>) : NonEmptySeq<'T> =
495495
Seq.insertManyAt index values source |> unsafeOfSeq
496-
496+
#endif
497497
/// <summary>Returns the element at the specified index.</summary>
498498
/// <param name="index">The index of the element to retrieve.</param>
499499
/// <param name="source">The input sequence.</param>
@@ -696,6 +696,7 @@ module NonEmptySeq =
696696
let reduceBack (reduction: 'T -> 'T -> 'T) (source: NonEmptySeq<'T>) =
697697
Seq.reduceBack reduction source
698698

699+
#if !NET45
699700
/// <summary>Removes the element at the specified index.</summary>
700701
/// <param name="index">The index of the element to remove.</param>
701702
/// <param name="source">The input sequence.</param>
@@ -727,7 +728,8 @@ module NonEmptySeq =
727728
/// <exception cref="System.ArgumentException">Thrown when removing the items results in an empty sequence.</exception>
728729
let removeManyAt (index: int) (count: int) (source: NonEmptySeq<'T>) : NonEmptySeq<'T> =
729730
Seq.removeManyAt index count source |> ofSeq
730-
731+
#endif
732+
731733
/// <summary>Creates a sequence that contains one repeated value.</summary>
732734
/// <param name="count">The number of elements.</param>
733735
/// <param name="value">The value to replicate.</param>
@@ -1040,15 +1042,17 @@ module NonEmptySeq =
10401042
/// <returns>A tuple containing the three sequences.</returns>
10411043
let unzip3 (source: NonEmptySeq<'T1 * 'T2 * 'T3>) : NonEmptySeq<'T1> * NonEmptySeq<'T2> * NonEmptySeq<'T3> =
10421044
source |> Seq.toList |> List.unzip3 |> fun (a, b, c) -> (unsafeOfSeq a, unsafeOfSeq b, unsafeOfSeq c)
1043-
1045+
1046+
#if !NET45
10441047
/// <summary>Updates the element at the specified index.</summary>
10451048
/// <param name="index">The index of the element to update.</param>
10461049
/// <param name="value">The new value.</param>
10471050
/// <param name="source">The input sequence.</param>
10481051
/// <returns>The result sequence.</returns>
10491052
let updateAt (index: int) (value: 'T) (source: NonEmptySeq<'T>) : NonEmptySeq<'T> =
10501053
Seq.updateAt index value source |> unsafeOfSeq
1051-
1054+
#endif
1055+
10521056
/// <summary>Returns a sequence that contains the elements of the sequence for which the given function returns <c>true</c>.</summary>
10531057
/// <param name="predicate">A function to test each element of the sequence.</param>
10541058
/// <param name="source">The input sequence.</param>

0 commit comments

Comments
 (0)