You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/FSharpPlus/Control/Applicative.fs
+6-31Lines changed: 6 additions & 31 deletions
Original file line number
Diff line number
Diff line change
@@ -91,45 +91,20 @@ type Apply =
91
91
letf,x = f.Value, x.Value
92
92
KeyValuePair2 (Plus.Invoke a b, f x)
93
93
94
-
static member ``<*>`` (struct(f:Map<'Key,_>,x:Map<'Key,'T>),_output:Map<'Key,'U>,[<Optional>]_mthd:Apply):Map<'Key,'U>= Map (seq{
95
-
for KeyValue(k, vf)in f do
96
-
match Map.tryFind k x with
97
-
| Some vx ->yield k, vf vx
98
-
|_->()})
99
-
100
-
static member ``<*>`` (struct(f:Dictionary<'Key,_>,x:Dictionary<'Key,'T>),_output:Dictionary<'Key,'U>,[<Optional>]_mthd:Apply):Dictionary<'Key,'U>=
101
-
letdct= Dictionary ()
102
-
for KeyValue(k, vf)in f do
103
-
match x.TryGetValue k with
104
-
|true, vx -> dct.Add (k, vf vx)
105
-
|_->()
106
-
dct
107
-
108
-
static member ``<*>`` (struct(f:IDictionary<'Key,_>,x:IDictionary<'Key,'T>),_output:IDictionary<'Key,'U>,[<Optional>]_mthd:Apply):IDictionary<'Key,'U>=
109
-
letdct= Dictionary ()
110
-
for KeyValue(k, vf)in f do
111
-
match x.TryGetValue k with
112
-
|true, vx -> dct.Add (k, vf vx)
113
-
|_->()
114
-
dct :> IDictionary<'Key,'U>
115
-
116
-
static member ``<*>`` (struct(f:IReadOnlyDictionary<'Key,_>,x:IReadOnlyDictionary<'Key,'T>),_output:IReadOnlyDictionary<'Key,'U>,[<Optional>]_mthd:Apply):IReadOnlyDictionary<'Key,'U>=
117
-
letdct= Dictionary ()
118
-
for KeyValue(k, vf)in f do
119
-
match x.TryGetValue k with
120
-
|true, vx -> dct.Add (k, vf vx)
121
-
|_->()
122
-
dct :> IReadOnlyDictionary<'Key,'U>
94
+
static member ``<*>`` (struct(f:Map<'Key,_>,x:Map<'Key,'T>),_output:Map<'Key,'U>,[<Optional>]_mthd:Apply):Map<'Key,'U>= Map.apply f x
95
+
static member ``<*>`` (struct(f:Dictionary<'Key,_>,x:Dictionary<'Key,'T>),_output:Dictionary<'Key,'U>,[<Optional>]_mthd:Apply):Dictionary<'Key,'U>= Dictionary.apply f x
96
+
static member ``<*>`` (struct(f:IDictionary<'Key,_>,x:IDictionary<'Key,'T>),_output:IDictionary<'Key,'U>,[<Optional>]_mthd:Apply):IDictionary<'Key,'U>= Dict.apply f x
97
+
static member ``<*>`` (struct(f:IReadOnlyDictionary<'Key,_>,x:IReadOnlyDictionary<'Key,'T>),_output:IReadOnlyDictionary<'Key,'U>,[<Optional>]_mthd:Apply):IReadOnlyDictionary<'Key,'U>= IReadOnlyDictionary.apply f x
123
98
124
99
#if!FABLE_COMPILER
125
100
// Compatibility member:
126
101
static member ``<*>`` (f:Expr<'T->'U>,x:Expr<'T>,[<Optional>]_output:Expr<'U>,[<Optional>]_mthd:Apply)= Expr.Cast<'U>(Expr.Application (f, x))
static member ``<*>`` (struct(f:Expr<'T->'U>,x:Expr<'T>),_output:Expr<'U>,[<Optional>]_mthd:Apply)= Expr.Cast<'U>(Expr.Application (f, x))
128
103
#endif
129
104
// Compatibility member:
130
105
static member ``<*>`` (f:('T->'U) ResizeArray,x:'T ResizeArray,[<Optional>]_output:'U ResizeArray,[<Optional>]_mthd:Apply)= ResizeArray.apply f x : 'U ResizeArray
131
106
132
-
static member``<*>`` (struct(f:('T->'U) ResizeArray,x:'T ResizeArray),_output:'U ResizeArray,[<Optional>]_mthd:Apply)= ResizeArray.apply f x : 'U ResizeArray
107
+
static member ``<*>`` (struct(f:('T->'U) ResizeArray,x:'T ResizeArray),_output:'U ResizeArray,[<Optional>]_mthd:Apply)= ResizeArray.apply f x : 'U ResizeArray
133
108
134
109
static member inlineInvoke(f:'``Applicative<'T->'U>``)(x:'``Applicative<'T>``):'``Applicative<'U>`` =
135
110
let inlinecall(mthd :^M,input1:^I1,input2:^I2,output:^R)=
Copy file name to clipboardExpand all lines: src/FSharpPlus/Control/Foldable.fs
+7Lines changed: 7 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -148,6 +148,10 @@ type FoldMap =
148
148
static member inlineFoldMap(x:Set<_>,f,[<Optional>]_impl:FoldMap)= Seq.fold (fun x y -> Plus.Invoke x (f y))(Zero.Invoke ()) x
149
149
static member inlineFoldMap(x:_ [],f,[<Optional>]_impl:FoldMap)= Array.fold (fun x y -> Plus.Invoke x (f y))(Zero.Invoke ()) x
150
150
151
+
static member inlineFoldMap(x:Map<_,_>,f,[<Optional>]_impl:FoldMap)= Map.fold (fun x _ y -> Plus.Invoke x (f y))(Zero.Invoke ()) x
152
+
static member inlineFoldMap(x:IDictionary<_,_>,f,[<Optional>]_impl:FoldMap)= Dict.fold (fun x _ y -> Plus.Invoke x (f y))(Zero.Invoke ()) x
153
+
static member inlineFoldMap(x:IReadOnlyDictionary<_,_>,f,[<Optional>]_impl:FoldMap)= IReadOnlyDictionary.fold (fun x _ y -> Plus.Invoke x (f y))(Zero.Invoke ()) x
154
+
151
155
static member inlineInvoke(f:'T->'Monoid)(x:'``Foldable'<T>``):'Monoid =
152
156
let inlinecall_2(a:^a,b:^b,f)=((^aor^b):(static memberFoldMap:_*_*_->_) b, f, a)
153
157
let inlinecall(a:'a,b:'b,f)= call_2 (a, b, f)
@@ -186,6 +190,9 @@ type Fold =
186
190
static memberFold(x:list<_>,f,z ,[<Optional>]_impl:Fold )= List.fold f z x
187
191
static memberFold(x:Set<_>,f,z ,[<Optional>]_impl:Fold )= Set.fold f z x
188
192
static memberFold(x:_ [],f,z ,[<Optional>]_impl:Fold )= Array.fold f z x
193
+
static memberFold(x:Map<_,_>,f,z ,[<Optional>]_impl:Fold )= Map.fold (fun s _ -> f s) z x
194
+
static memberFold(x:IDictionary<_,_>,f,z ,[<Optional>]_impl:Fold )= Dict.fold (fun s _ -> f s) z x
195
+
static memberFold(x:IReadOnlyDictionary<_,_>,f,z ,[<Optional>]_impl:Fold )= IReadOnlyDictionary.fold (fun s _ -> f s) z x
189
196
190
197
static member inlineInvoke(folder:'State->'T->'State)(state:'State)(foldable:'``Foldable'<T>``):'State =
191
198
let inlinecall_2(a:^a,b:^b,f,z)=((^aor^b):(static memberFold:_*_*_*_->_) b, f, z, a)
static memberZip((x:NonEmptySeq<'T>,y:NonEmptySeq<'U>,_output:NonEmptySeq<'T*'U>),_mthd:Zip)= NonEmptySeq.zip x y
225
225
static memberZip((x:IDictionary<'K,'T>,y:IDictionary<'K,'U>,_output:IDictionary<'K,'T*'U>),_mthd:Zip)= Dict.zip x y
226
226
static memberZip((x:IReadOnlyDictionary<'K,'T>,y:IReadOnlyDictionary<'K,'U>,_output:IReadOnlyDictionary<'K,'T*'U>),_mthd:Zip)= IReadOnlyDictionary.zip x y
227
-
static memberZip((x:Dictionary<'K,'T>,y:Dictionary<'K,'U>,_output:Dictionary<'K,'T*'U>),_mthd:Zip)=Dict.zip x y :?> Dictionary<'K,'T*'U>
227
+
static memberZip((x:Dictionary<'K,'T>,y:Dictionary<'K,'U>,_output:Dictionary<'K,'T*'U>),_mthd:Zip)=Dictionary.zip x y
228
228
static memberZip((x:Map<'K,'T>,y:Map<'K,'U>,_output:Map<'K,'T*'U>),_mthd:Zip)= Map.zip x y
229
229
static memberZip((f:'R ->'T ,g:'R ->'U ,_output:'R ->'T * 'U ),_mthd:Zip)=fun x ->(f x, g x)
230
230
static memberZip((f:Func<'R,'T>,g:Func<'R,'U>,_output:Func<'R,'T*'U>),_mthd:Zip)= Func<_,_>(fun x ->(f.Invoke x, g.Invoke x))
0 commit comments