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-26Lines changed: 6 additions & 26 deletions
Original file line number
Diff line number
Diff line change
@@ -42,35 +42,15 @@ type Apply =
42
42
letf,x = f.Value, x.Value
43
43
KeyValuePair2 (Plus.Invoke a b, f x)
44
44
45
-
static member ``<*>`` (struct(f:Map<'Key,_>,x:Map<'Key,'T>),_output:Map<'Key,'U>,[<Optional>]_mthd:Apply):Map<'Key,'U>= Map (seq{
46
-
for KeyValue(k, vf)in f do
47
-
match Map.tryFind k x with
48
-
| Some vx ->yield k, vf vx
49
-
|_->()})
50
-
51
-
static member ``<*>`` (struct(f:Dictionary<'Key,_>,x:Dictionary<'Key,'T>),_output:Dictionary<'Key,'U>,[<Optional>]_mthd:Apply):Dictionary<'Key,'U>=
52
-
letdct= Dictionary ()
53
-
for KeyValue(k, vf)in f do
54
-
match x.TryGetValue k with
55
-
|true, vx -> dct.Add (k, vf vx)
56
-
|_->()
57
-
dct
58
-
59
-
static member ``<*>`` (struct(f:IDictionary<'Key,_>,x:IDictionary<'Key,'T>),_output:IDictionary<'Key,'U>,[<Optional>]_mthd:Apply):IDictionary<'Key,'U>=
60
-
Dict.map2 id f x
61
-
62
-
static member ``<*>`` (struct(f:IReadOnlyDictionary<'Key,_>,x:IReadOnlyDictionary<'Key,'T>),_output:IReadOnlyDictionary<'Key,'U>,[<Optional>]_mthd:Apply):IReadOnlyDictionary<'Key,'U>=
63
-
letdct= Dictionary ()
64
-
for KeyValue(k, vf)in f do
65
-
match x.TryGetValue k with
66
-
|true, vx -> dct.Add (k, vf vx)
67
-
|_->()
68
-
dct :> IReadOnlyDictionary<'Key,'U>
45
+
static member ``<*>`` (struct(f:Map<'Key,_>,x:Map<'Key,'T>),_output:Map<'Key,'U>,[<Optional>]_mthd:Apply):Map<'Key,'U>= Map.apply f x
46
+
static member ``<*>`` (struct(f:Dictionary<'Key,_>,x:Dictionary<'Key,'T>),_output:Dictionary<'Key,'U>,[<Optional>]_mthd:Apply):Dictionary<'Key,'U>= Dictionary.apply f x
47
+
static member ``<*>`` (struct(f:IDictionary<'Key,_>,x:IDictionary<'Key,'T>),_output:IDictionary<'Key,'U>,[<Optional>]_mthd:Apply):IDictionary<'Key,'U>= Dict.apply f x
48
+
static member ``<*>`` (struct(f:IReadOnlyDictionary<'Key,_>,x:IReadOnlyDictionary<'Key,'T>),_output:IReadOnlyDictionary<'Key,'U>,[<Optional>]_mthd:Apply):IReadOnlyDictionary<'Key,'U>= IReadOnlyDictionary.apply 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))
72
52
#endif
73
-
static member``<*>`` (struct(f:('T->'U) ResizeArray,x:'T ResizeArray),_output:'U ResizeArray,[<Optional>]_mthd:Apply)= ResizeArray.apply f x : 'U ResizeArray
53
+
static member ``<*>`` (struct(f:('T->'U) ResizeArray,x:'T ResizeArray),_output:'U ResizeArray,[<Optional>]_mthd:Apply)= ResizeArray.apply f x : 'U ResizeArray
74
54
75
55
static member inlineInvoke(f:'``Applicative<'T->'U>``)(x:'``Applicative<'T>``):'``Applicative<'U>`` =
76
56
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
@@ -147,6 +147,10 @@ type FoldMap =
147
147
static member inlineFoldMap(x:Set<_>,f,[<Optional>]_impl:FoldMap)= Seq.fold (fun x y -> Plus.Invoke x (f y))(Zero.Invoke ()) x
148
148
static member inlineFoldMap(x:_ [],f,[<Optional>]_impl:FoldMap)= Array.fold (fun x y -> Plus.Invoke x (f y))(Zero.Invoke ()) x
149
149
150
+
static member inlineFoldMap(x:Map<_,_>,f,[<Optional>]_impl:FoldMap)= Map.fold (fun x _ y -> Plus.Invoke x (f y))(Zero.Invoke ()) x
151
+
static member inlineFoldMap(x:IDictionary<_,_>,f,[<Optional>]_impl:FoldMap)= Dict.fold (fun x _ y -> Plus.Invoke x (f y))(Zero.Invoke ()) x
152
+
static member inlineFoldMap(x:IReadOnlyDictionary<_,_>,f,[<Optional>]_impl:FoldMap)= IReadOnlyDictionary.fold (fun x _ y -> Plus.Invoke x (f y))(Zero.Invoke ()) x
153
+
150
154
static member inlineInvoke(f:'T->'Monoid)(x:'``Foldable'<T>``):'Monoid =
151
155
let inlinecall_2(a:^a,b:^b,f)=((^aor^b):(static memberFoldMap:_*_*_->_) b, f, a)
152
156
let inlinecall(a:'a,b:'b,f)= call_2 (a, b, f)
@@ -185,6 +189,9 @@ type Fold =
185
189
static memberFold(x:list<_>,f,z ,[<Optional>]_impl:Fold )= List.fold f z x
186
190
static memberFold(x:Set<_>,f,z ,[<Optional>]_impl:Fold )= Set.fold f z x
187
191
static memberFold(x:_ [],f,z ,[<Optional>]_impl:Fold )= Array.fold f z x
192
+
static memberFold(x:Map<_,_>,f,z ,[<Optional>]_impl:Fold )= Map.fold (fun s _ -> f s) z x
193
+
static memberFold(x:IDictionary<_,_>,f,z ,[<Optional>]_impl:Fold )= Dict.fold (fun s _ -> f s) z x
194
+
static memberFold(x:IReadOnlyDictionary<_,_>,f,z ,[<Optional>]_impl:Fold )= IReadOnlyDictionary.fold (fun s _ -> f s) z x
188
195
189
196
static member inlineInvoke(folder:'State->'T->'State)(state:'State)(foldable:'``Foldable'<T>``):'State =
190
197
let inlinecall_2(a:^a,b:^b,f,z)=((^aor^b):(static memberFold:_*_*_*_->_) b, f, z, a)
static memberZip((x:seq<'T>,y:seq<'U>,_output:seq<'T*'U>),_mthd:Zip)= Seq.zip x y
209
209
static memberZip((x:IDictionary<'K,'T>,y:IDictionary<'K,'U>,_output:IDictionary<'K,'T*'U>),_mthd:Zip)= Dict.zip x y
210
210
static memberZip((x:IReadOnlyDictionary<'K,'T>,y:IReadOnlyDictionary<'K,'U>,_output:IReadOnlyDictionary<'K,'T*'U>),_mthd:Zip)= IReadOnlyDictionary.zip x y
211
-
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>
211
+
static memberZip((x:Dictionary<'K,'T>,y:Dictionary<'K,'U>,_output:Dictionary<'K,'T*'U>),_mthd:Zip)=Dictionary.zip x y
212
212
static memberZip((x:Map<'K,'T>,y:Map<'K,'U>,_output:Map<'K,'T*'U>),_mthd:Zip)= Map.zip x y
213
213
static memberZip((f:'R ->'T ,g:'R ->'U ,_output:'R ->'T * 'U ),_mthd:Zip)=fun x ->(f x, g x)
214
214
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