@@ -50,13 +50,29 @@ type Bind =
5050 | Some v -> yield k, v
5151 | _ -> () })
5252
53- static member (>>= ) ( source: Dictionary< 'Key, 'T>, f: 'T -> Dictionary< 'Key, 'U>) =
54- let dct = Dictionary ()
55- for KeyValue( k, v) in source do
56- match ( f v) .TryGetValue ( k) with
57- | true , v -> dct.Add ( k, v)
58- | _ -> ()
59- dct
53+ static member (>>= ) ( source: Dictionary< 'Key, 'T>, f: 'T -> Dictionary< 'Key, 'U>) =
54+ let dct = Dictionary ()
55+ for KeyValue( k, v) in source do
56+ match ( f v) .TryGetValue ( k) with
57+ | true , v -> dct.Add ( k, v)
58+ | _ -> ()
59+ dct
60+
61+ static member (>>= ) ( source: IDictionary< 'Key, 'T>, f: 'T -> IDictionary< 'Key, 'U>) =
62+ let dct = Dictionary ()
63+ for KeyValue( k, v) in source do
64+ match ( f v) .TryGetValue ( k) with
65+ | true , v -> dct.Add ( k, v)
66+ | _ -> ()
67+ dct :> IDictionary< 'Key, 'U>
68+
69+ static member (>>= ) ( source: IReadOnlyDictionary< 'Key, 'T>, f: 'T -> IReadOnlyDictionary< 'Key, 'U>) =
70+ let dct = Dictionary ()
71+ for KeyValue( k, v) in source do
72+ match ( f v) .TryGetValue ( k) with
73+ | true , v -> dct.Add ( k, v)
74+ | _ -> ()
75+ dct :> IReadOnlyDictionary< 'Key, 'U>
6076
6177 static member (>>= ) ( source: ResizeArray< 'T>, f: 'T -> ResizeArray< 'U>) = ResizeArray ( Seq.bind ( f >> seq<_>) source) : ResizeArray< 'U>
6278
@@ -114,6 +130,22 @@ type Join =
114130 | _ -> ()
115131 dct
116132
133+ static member Join ( x : IDictionary < _ , IDictionary < _ , _ >>, [<Optional>] _output : IDictionary < 'Key , 'Value >, [<Optional>] _mthd : Join ) : IDictionary < 'Key , 'Value > =
134+ let dct = Dictionary ()
135+ for KeyValue( k, v) in x do
136+ match v.TryGetValue ( k) with
137+ | true , v -> dct.Add ( k, v)
138+ | _ -> ()
139+ dct :> IDictionary< 'Key, 'U>
140+
141+ static member Join ( x : IReadOnlyDictionary < _ , IReadOnlyDictionary < _ , _ >>, [<Optional>] _output : IReadOnlyDictionary < 'Key , 'Value >, [<Optional>] _mthd : Join ) : IReadOnlyDictionary < 'Key , 'Value > =
142+ let dct = Dictionary ()
143+ for KeyValue( k, v) in x do
144+ match v.TryGetValue ( k) with
145+ | true , v -> dct.Add ( k, v)
146+ | _ -> ()
147+ dct :> IReadOnlyDictionary< 'Key, 'U>
148+
117149 static member Join ( x : ResizeArray < ResizeArray < 'T >> , [<Optional>] _output : ResizeArray < 'T > , [<Optional>] _mthd : Join ) = ResizeArray ( Seq.bind seq<_> x) : ResizeArray< 'T>
118150
119151 static member Join ( x : NonEmptySeq < NonEmptySeq < 'T >> , [<Optional>] _output : NonEmptySeq < 'T > , [<Optional>] _mthd : Join ) = NonEmptySeq.concat x : NonEmptySeq< 'T>
0 commit comments