diff --git a/src/FSharpPlus/Extensions/ResizeArray.fs b/src/FSharpPlus/Extensions/ResizeArray.fs
index f321b13e6..7a2e02f41 100644
--- a/src/FSharpPlus/Extensions/ResizeArray.fs
+++ b/src/FSharpPlus/Extensions/ResizeArray.fs
@@ -24,10 +24,10 @@ module ResizeArray =
/// Applies the given function to each element of the collection.
/// The function to apply to elements from the input ResizeArray.
/// The input ResizeArray.
- let iter (action: 'T -> 'U) (source: ResizeArray<'T>) =
+ let iter (action: 'T -> unit) (source: ResizeArray<'T>) : unit =
raiseIfNull (nameof source) source
- ResizeArray (Seq.map action source)
+ Seq.iter action source
/// Applies a ResizeArray of functions to a ResizeArray of values and concatenates them.
/// The functions.
@@ -81,16 +81,16 @@ module ResizeArray =
source |> Array.toSeq |> Seq.intersperse element |> Seq.toArray : 'T []
/// Creates a sequence of arrays by splitting the source array on any of the given separators.
- let split (separators: seq<_ []>) (source: _ []) =
+ let split (separators: seq>) (source: ResizeArray<'T>) : seq> =
raiseIfNull (nameof separators) separators
raiseIfNull (nameof source) source
- source |> Array.toSeq |> Seq.split separators |> Seq.map Seq.toArray
+ source |> Seq.split separators |> Seq.map ResizeArray
/// Replaces a subsequence of the source array with the given replacement array.
- let replace (oldValue: _ []) (newValue: _ []) source =
+ let replace (oldValue: ResizeArray<'T>) (newValue: ResizeArray<'T>) (source: ResizeArray<'T>) : ResizeArray<'T> =
raiseIfNull (nameof oldValue) oldValue
raiseIfNull (nameof source) source
- source |> Array.toSeq |> Seq.replace oldValue newValue |> Seq.toArray : 'T []
+ source |> Seq.replace oldValue newValue |> ResizeArray
#if !FABLE_COMPILER
@@ -103,13 +103,13 @@ module ResizeArray =
///
/// The index of the slice.
///
- let findSliceIndex (slice: _ []) (source: _ []) =
+ let findSliceIndex (slice: ResizeArray<'T>) (source: ResizeArray<'T>) : int =
raiseIfNull (nameof slice) slice
raiseIfNull (nameof source) source
- let index = Internals.FindSliceIndex.arrayImpl slice source
+ let index = Internals.FindSliceIndex.seqImpl slice source
if index = -1 then
- ArgumentException("The specified slice was not found in the sequence.") |> raise
+ invalidArg (nameof slice) "The specified slice was not found in the sequence."
else
index
@@ -120,11 +120,11 @@ module ResizeArray =
///
/// The index of the slice or None.
///
- let tryFindSliceIndex (slice: _ []) (source: _ []) =
+ let tryFindSliceIndex (slice: ResizeArray<'T>) (source: ResizeArray<'T>) : int option =
raiseIfNull (nameof slice) slice
raiseIfNull (nameof source) source
- let index = Internals.FindSliceIndex.arrayImpl slice source
+ let index = Internals.FindSliceIndex.seqImpl slice source
if index = -1 then None else Some index
///
@@ -136,10 +136,10 @@ module ResizeArray =
///
/// The index of the slice.
///
- let findLastSliceIndex (slice: _ []) (source: _ []) =
- let index = Internals.FindLastSliceIndex.arrayImpl slice source
+ let findLastSliceIndex (slice: ResizeArray<'T>) (source: ResizeArray<'T>) : int =
+ let index = Internals.FindLastSliceIndex.seqImpl slice source
if index = -1 then
- ArgumentException("The specified slice was not found in the sequence.") |> raise
+ invalidArg (nameof slice) "The specified slice was not found in the sequence."
else
index
@@ -150,8 +150,8 @@ module ResizeArray =
///
/// The index of the slice or None.
///
- let tryFindLastSliceIndex (slice: _ []) (source: _ []) =
- let index = Internals.FindLastSliceIndex.arrayImpl slice source
+ let tryFindLastSliceIndex (slice: ResizeArray<'T>) (source: ResizeArray<'T>) : int option =
+ let index = Internals.FindLastSliceIndex.seqImpl slice source
if index = -1 then None else Some index
#endif
@@ -162,12 +162,12 @@ module ResizeArray =
///
/// A tuple with both resulting arrays.
///
- let partitionMap (mapper: 'T -> Choice<'T1,'T2>) (source: array<'T>) =
+ let partitionMap (mapper: 'T -> Choice<'T1,'T2>) (source: ResizeArray<'T>) : ResizeArray<'T1> * ResizeArray<'T2> =
raiseIfNull (nameof source) source
let (x, y) = ResizeArray (), ResizeArray ()
- Array.iter (mapper >> function Choice1Of2 e -> x.Add e | Choice2Of2 e -> y.Add e) source
- x.ToArray (), y.ToArray ()
+ iter (mapper >> function Choice1Of2 e -> x.Add e | Choice2Of2 e -> y.Add e) source
+ x, y
/// Safely build a new ResizeArray whose elements are the results of applying the given function
/// to each of the elements of the two ResizeArrays pairwise.
diff --git a/src/FSharpPlus/Extensions/Seq.fs b/src/FSharpPlus/Extensions/Seq.fs
index c493f5824..90f73e8cc 100644
--- a/src/FSharpPlus/Extensions/Seq.fs
+++ b/src/FSharpPlus/Extensions/Seq.fs
@@ -49,10 +49,10 @@ module Seq =
/// Third seq.
///
/// Seq with values returned from mapping function.
- let lift3 f x1 x2 x3 =
+ let lift3 (f: 'T1 -> 'T2 -> 'T3 -> 'U) (x1: seq<'T1>) (x2: seq<'T2>) (x3: seq<'T3>) : seq<'U> =
Seq.allPairs x2 x3
|> Seq.allPairs x1
- |> Seq.map (fun x -> (fst (snd x), snd (snd x), fst x))
+ |> Seq.map (fun x -> (fst x, fst (snd x), snd (snd x)))
|> Seq.map (fun (x, y, z) -> f x y z)
/// Applies a function to each element of the collection, starting from the end, threading an accumulator argument
diff --git a/src/FSharpPlus/Extensions/String.fs b/src/FSharpPlus/Extensions/String.fs
index 270711026..7eddcd68f 100644
--- a/src/FSharpPlus/Extensions/String.fs
+++ b/src/FSharpPlus/Extensions/String.fs
@@ -63,13 +63,13 @@ module String =
Seq.contains char source
- /// Converts to uppercase -- nullsafe function wrapper for String.ToUpperInvariant method.
+ /// Converts to uppercase -- function wrapper for String.ToUpperInvariant method.
let toUpper (source: string) =
raiseIfNull (nameof source) source
if isNull source then source else source.ToUpperInvariant ()
- /// Converts to lowercase -- nullsafe function wrapper for String.ToLowerInvariant method.
+ /// Converts to lowercase -- function wrapper for String.ToLowerInvariant method.
let toLower (source: string) =
raiseIfNull (nameof source) source