Skip to content

Commit 25baab4

Browse files
committed
Ambiguate keyValuePair
1 parent ee0f250 commit 25baab4

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/FSharpPlus/Control/Applicative.fs

+6
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ type Apply =
3737
static member ``<*>`` ((f: Result<_,'E> , x: Result<'T,'E> , _output: Result<'b,'E> ) , [<Optional>]_mthd: Apply) = Result.apply f x : Result<'U,'E>
3838
static member ``<*>`` ((f: Choice<_,'E> , x: Choice<'T,'E> , _output: Choice<'b,'E> ) , [<Optional>]_mthd: Apply) = Choice.apply f x : Choice<'U,'E>
3939
static member inline ``<*>`` ((KeyValue(a: 'Key, f), KeyValue(b: 'Key, x: 'T), _output: KeyValuePair<'Key,'U>), [<Optional>]_mthd: Apply) : KeyValuePair<'Key,'U> = KeyValuePair (Plus.Invoke a b, f x)
40+
static member inline ``<*>`` ((f: KeyValuePair2<'Key, _>, x: KeyValuePair2<'Key, 'T>, _output: KeyValuePair2<'Key,'U>), [<Optional>]_mthd: Apply) : KeyValuePair2<'Key,'U> =
41+
let a = f.Key
42+
let b = x.Key
43+
let f = f.Value
44+
let x = x.Value
45+
KeyValuePair2 (Plus.Invoke a b, f x)
4046

4147
static member ``<*>`` ((f: Map<'Key,_> , x: Map<'Key,'T> , _output: Map<'Key,'U> ) , [<Optional>]_mthd: Apply) : Map<'Key,'U> = Map (seq {
4248
for KeyValue(k, vf) in f do

src/FSharpPlus/Internals.fs

+6
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,12 @@ type Either<'t,'u> =
125125

126126
type DmStruct = struct end
127127

128+
type KeyValuePair2<'TKey, 'TValue> = struct
129+
val Key : 'TKey
130+
val Value : 'TValue
131+
new (key, value) = { Key = key; Value = value }
132+
end
133+
128134
[<Sealed>]
129135
type Set2<'T when 'T: comparison >() = class end
130136

0 commit comments

Comments
 (0)