From 71244e633c6f4a26a05bd40c1229437be51ff861 Mon Sep 17 00:00:00 2001 From: gusty <1261319+gusty@users.noreply.github.com> Date: Sat, 24 Jan 2026 19:41:23 +0100 Subject: [PATCH] Add function setItem --- src/FSharpPlus/Operators.fs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/FSharpPlus/Operators.fs b/src/FSharpPlus/Operators.fs index 44130d98f..8d1eba66d 100644 --- a/src/FSharpPlus/Operators.fs +++ b/src/FSharpPlus/Operators.fs @@ -3,6 +3,8 @@ namespace FSharpPlus open System open FSharpPlus.Control +#nowarn "0077" // Member constraints with the name 'set_Item' ... + /// Generic functions and operators [] module Operators = @@ -849,6 +851,17 @@ module Operators = /// Indexable let inline tryItem (n: 'K) (source: '``Indexed<'T>``) : 'T option = TryItem.Invoke n source + /// + /// Mutates an item at the given key/index. + /// + /// The key/index where to set the value. + /// The value to set. + /// The input collection. + /// unit + /// This function requires that the source type has a mutable indexer. + /// Indexable + let inline setItem (item: 'K) (value: 'T) (source: ^``Indexed<'T>``) = (^``Indexed<'T>`` : (member set_Item : 'K -> 'T -> unit) (source, item, value)) + /// /// Maps with access to the index. ///