Skip to content

Commit

Permalink
NoPartialFunctions: stop suggesting tryLast instead of tail
Browse files Browse the repository at this point in the history
tryLast doesn't have the same goal as tail; let's rather suggest
FSharpx.Collections.Seq.tryHeadTail extension for now, which has
just been merged [1] and will be in 3.0.0 release (at least until
we have a tryTail of some sort [2]).

[1] fsprojects/FSharpx.Collections#176
[2] fsharp/fslang-suggestions#803
  • Loading branch information
knocte committed Sep 20, 2021
1 parent 3837680 commit f3098c0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/FSharpLint.Core/Rules/Conventions/NoPartialFunctions.fs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ let private partialFunctionIdentifiers =
("Array.findBack", Function "Array.tryFindBack")
("Array.head", Function "Array.tryHead")
("Array.last", Function "Array.tryLast")
("Array.tail", Function "Array.tryLast")
("Array.tail", Function "FSharpx.Collections.Seq.tryHeadTail")
("Array.reduce", Function "Array.fold")
("Array.reduceBack", Function "Array.foldBack")
("Array.pick", Function "Array.tryPick")
Expand All @@ -48,7 +48,7 @@ let private partialFunctionIdentifiers =
("Seq.findBack", Function "Seq.tryFindBack")
("Seq.head", Function "Seq.tryHead")
("Seq.last", Function "Seq.tryLast")
("Seq.tail", Function "Seq.tryLast")
("Seq.tail", Function "FSharpx.Collections.Seq.tryHeadTail")
("Seq.reduce", Function "Seq.fold")
("Seq.reduceBack", Function "Seq.foldBack")
("Seq.pick", Function "Seq.tryPick")
Expand All @@ -61,7 +61,7 @@ let private partialFunctionIdentifiers =
("List.findBack", Function "List.tryFindBack")
("List.head", Function "List.tryHead")
("List.last", Function "List.tryLast")
("List.tail", Function "List.tryLast")
("List.tail", Function "FSharpx.Collections.Seq.tryHeadTail")
("List.reduce", Function "List.fold")
("List.reduceBack", Function "List.foldBack")
("List.pick", Function "List.tryPick")
Expand Down

0 comments on commit f3098c0

Please sign in to comment.