From 8412408e0587903d9e1135d9d5c42614a181c115 Mon Sep 17 00:00:00 2001 From: gusty <1261319+gusty@users.noreply.github.com> Date: Wed, 22 Nov 2023 10:36:22 +0100 Subject: [PATCH] Ambiguate keyValuePair --- src/FSharpPlus/Control/Applicative.fs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/FSharpPlus/Control/Applicative.fs b/src/FSharpPlus/Control/Applicative.fs index 3efc71ea7..a795bf448 100644 --- a/src/FSharpPlus/Control/Applicative.fs +++ b/src/FSharpPlus/Control/Applicative.fs @@ -10,6 +10,11 @@ open FSharpPlus.Internals open FSharpPlus open FSharpPlus.Data +type KeyValuePair2<'TKey, 'TValue> = struct + val Key : 'TKey + val Value : 'TValue + new (key, value) = { Key = key; Value = value } +end type Apply = inherit Default1 @@ -37,6 +42,12 @@ type Apply = static member ``<*>`` ((f: Result<_,'E> , x: Result<'T,'E> , _output: Result<'b,'E> ) , []_mthd: Apply) = Result.apply f x : Result<'U,'E> static member ``<*>`` ((f: Choice<_,'E> , x: Choice<'T,'E> , _output: Choice<'b,'E> ) , []_mthd: Apply) = Choice.apply f x : Choice<'U,'E> static member inline ``<*>`` ((KeyValue(a: 'Key, f), KeyValue(b: 'Key, x: 'T), _output: KeyValuePair<'Key,'U>), []_mthd: Apply) : KeyValuePair<'Key,'U> = KeyValuePair (Plus.Invoke a b, f x) + static member inline ``<*>`` ((f: KeyValuePair2<'Key, _>, x: KeyValuePair2<'Key, 'T>, _output: KeyValuePair2<'Key,'U>), []_mthd: Apply) : KeyValuePair2<'Key,'U> = + let a = f.Key + let b = x.Key + let f = f.Value + let x = x.Value + KeyValuePair2 (Plus.Invoke a b, f x) static member ``<*>`` ((f: Map<'Key,_> , x: Map<'Key,'T> , _output: Map<'Key,'U> ) , []_mthd: Apply) : Map<'Key,'U> = Map (seq { for KeyValue(k, vf) in f do