From c956fe414c4b82cb0243335c91888c47b159dfb9 Mon Sep 17 00:00:00 2001 From: Pavel Voronin Date: Sat, 5 Dec 2020 20:54:22 +0100 Subject: [PATCH] Mention Seq.truncate in error message for Seq.take --- src/fsharp/FSharp.Core/seq.fs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/fsharp/FSharp.Core/seq.fs b/src/fsharp/FSharp.Core/seq.fs index 766b209dcdd..f81e3f84aba 100644 --- a/src/fsharp/FSharp.Core/seq.fs +++ b/src/fsharp/FSharp.Core/seq.fs @@ -686,8 +686,8 @@ namespace Microsoft.FSharp.Collections seq { use e = source.GetEnumerator() for x in count .. - 1 .. 1 do if not (e.MoveNext()) then - invalidOpFmt "{0}: tried to take {1} {2} past the end of the seq" - [|SR.GetString SR.notEnoughElements; x; (if x = 1 then "element" else "elements")|] + invalidOpFmt "{0}: tried to take {1} {2} past the end of the seq. Use Seq.truncate to get {3} or less elements" + [|SR.GetString SR.notEnoughElements; x; (if x = 1 then "element" else "elements"); count|] yield e.Current } []