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
static member inlineInvoke(source:'``Foldable<'T>``):seq<'T>=
52
59
let inlinecall_2(a:^a,b:^b)=((^aor^b):(static memberToSeq:_*_->_) b, a)
@@ -56,7 +63,13 @@ type ToSeq =
56
63
static member inlineInvokeOnInstance(source:'``Foldable<'T>``):seq<'T>=(^``Foldable<'T>``:(static memberToSeq:_->_) source)
57
64
58
65
typeToSeqwith
59
-
static member inlineToSeq(x:'S when 'S :>Collections.IEnumerable,[<Optional>]_impl:Default2)=let_f i x :'T =(^S:(memberget_Item: int -> 'T) x, i)in Seq.cast<'T> x : seq<'T>
66
+
static member inlineToSeq(x:'S when 'S :>Collections.IEnumerable,[<Optional>]_impl:Default2)=
67
+
#if TEST_TRACE
68
+
Traces.add "ToSeq IEnumerable"
69
+
#endif
70
+
let_f i x :'T =(^S:(memberget_Item: int -> 'T) x, i)
71
+
Seq.cast<'T> x : seq<'T>
72
+
60
73
static member inlineToSeq(x:'Foldable ,[<Optional>]_impl:Default1)= ToSeq.InvokeOnInstance x
61
74
static member inlineToSeq(_:'T when 'T:null and 'T:struct ,_:Default1)=()
62
75
@@ -99,16 +112,22 @@ type ToArray =
99
112
100
113
typeFoldBack=
101
114
inherit Default1
102
-
static member inlineFoldBack(x:'F ,f:'a->'b->'b,z:'b ,[<Optional>]_impl:Default2)= List.foldBack f (ToList.Invoke x) z
115
+
static member inlineFoldBack(x:'F,f:'a ->'b ->'b,z:'b,[<Optional>]_impl:Default2)=
116
+
#if TEST_TRACE
117
+
Traces.add "Foldback Default"
118
+
#endif
119
+
List.foldBack f (ToList.Invoke x) z
103
120
static member inlineFoldBack(x:'F ,f:'a->'b->'b,z:'b ,[<Optional>]_impl:Default1)=(^F:(static memberFoldBack:^F->_->_->^b) x, f, z)
104
-
static memberFoldBack(x:seq<_>,f ,z ,[<Optional>]_impl:FoldBack)= List.foldBack f (Seq.toList x) z
105
-
static memberFoldBack(x:option<_>,f ,z ,[<Optional>]_impl:FoldBack)=match x with Some x -> f x z |_-> z
121
+
static memberFoldBack(x:seq<_>,f ,z ,[<Optional>]_impl:FoldBack)= List.foldBack f (Seq.toList x) z
122
+
static memberFoldBack(x:option<_>,f ,z ,[<Optional>]_impl:FoldBack)=match x with Some x -> f x z |_-> z
123
+
static memberFoldBack(x:voption<_>,f ,z ,[<Optional>]_impl:FoldBack)=match x with ValueSome x -> f x z |_-> z
124
+
static memberFoldBack(x:Result<_,_>,f ,z ,[<Optional>]_impl:FoldBack)=match x with Ok x -> f x z |_-> z
106
125
static memberFoldBack(x:list<_>,f ,z ,[<Optional>]_impl:FoldBack)= List.foldBack f x z
107
126
static memberFoldBack(x:_ [],f ,z ,[<Optional>]_impl:FoldBack)= Array.foldBack f x z
108
127
static memberFoldBack(x:Set<_>,f ,z ,[<Optional>]_impl:FoldBack)= Set.foldBack f x z
109
128
static memberFoldBack(x:_ ResizeArray,f ,z ,[<Optional>]_impl:FoldBack)= Array.foldBack f (x.ToArray ()) z
110
129
static memberFoldBack(x:string ,f ,z ,[<Optional>]_impl:FoldBack)= Array.foldBack f (x.ToCharArray ()) z
111
-
static memberFoldBack(x:StringBuilder,f ,z ,[<Optional>]_impl:FoldBack)= Array.foldBack f (x.ToString().ToCharArray ()) z
130
+
static memberFoldBack(x:StringBuilder,f ,z ,[<Optional>]_impl:FoldBack)= Array.foldBack f (x.ToString().ToCharArray ()) z
112
131
static memberFoldBack(x:Id<'a>,f ,z ,[<Optional>]_impl:FoldBack)= f x.getValue z
113
132
114
133
static member inlineInvoke(folder:'T->'State->'State)(state:'State)(foldable:'``Foldable'<T>``):'State =
@@ -122,18 +141,24 @@ type FoldMap =
122
141
123
142
static member inlineFromFoldFoldBack f x = FoldBack.Invoke (Plus.Invoke << f)(Zero.Invoke ()) x
124
143
125
-
static member inlineFoldMap(x:option<_>,f,[<Optional>]_impl:FoldMap )=match x with Some x -> f x |_-> Zero.Invoke ()
126
-
static member inlineFoldMap(x:list<_>,f,[<Optional>]_impl:FoldMap )= List.fold (fun x y -> Plus.Invoke x (f y))(Zero.Invoke ()) x
127
-
static member inlineFoldMap(x:Set<_>,f,[<Optional>]_impl:FoldMap )= Seq.fold (fun x y -> Plus.Invoke x (f y))(Zero.Invoke ()) x
128
-
static member inlineFoldMap(x:_ [],f,[<Optional>]_impl:FoldMap )= Array.fold (fun x y -> Plus.Invoke x (f y))(Zero.Invoke ()) x
144
+
static member inlineFoldMap(x:option<_>,f,[<Optional>]_impl:FoldMap)=match x with Some x -> f x |_-> Zero.Invoke ()
145
+
static member inlineFoldMap(x:voption<_>,f,[<Optional>]_impl:FoldMap)=match x with ValueSome x -> f x |_-> Zero.Invoke ()
146
+
static member inlineFoldMap(x:Result<_,_>,f,[<Optional>]_impl:FoldMap)=match x with Ok x -> f x |_-> Zero.Invoke ()
147
+
static member inlineFoldMap(x:list<_>,f,[<Optional>]_impl:FoldMap)= List.fold (fun x y -> Plus.Invoke x (f y))(Zero.Invoke ()) x
148
+
static member inlineFoldMap(x:Set<_>,f,[<Optional>]_impl:FoldMap)= Seq.fold (fun x y -> Plus.Invoke x (f y))(Zero.Invoke ()) x
149
+
static member inlineFoldMap(x:_ [],f,[<Optional>]_impl:FoldMap)= Array.fold (fun x y -> Plus.Invoke x (f y))(Zero.Invoke ()) x
129
150
130
151
static member inlineInvoke(f:'T->'Monoid)(x:'``Foldable'<T>``):'Monoid =
131
152
let inlinecall_2(a:^a,b:^b,f)=((^aor^b):(static memberFoldMap:_*_*_->_) b, f, a)
132
153
let inlinecall(a:'a,b:'b,f)= call_2 (a, b, f)
133
154
call (Unchecked.defaultof<FoldMap>, x, f)
134
155
135
156
typeFoldMapwith
136
-
static member inlineFoldMap(x:seq<_>,f,[<Optional>]_impl:Default2)= Seq.fold (fun x y -> Plus.Invoke x (f y))(Zero.Invoke ()) x
157
+
static member inlineFoldMap(x:seq<_>,f,[<Optional>]_impl:Default2)=
158
+
#if TEST_TRACE
159
+
Traces.add "FoldMap Default"
160
+
#endif
161
+
Seq.fold (fun x y -> Plus.Invoke x (f y))(Zero.Invoke ()) x
137
162
static member inlineFoldMap(x ,f,[<Optional>]_impl:Default1)=(^F:(static memberFoldMap:^F->_->_) x, f)
138
163
static member inlineFoldMap(_:^twhen^t:null and ^t:struct,_,_:Default1)=()
139
164
@@ -146,14 +171,21 @@ type Fold =
146
171
147
172
static member inlineFromFoldMap f z t =let(f:_Dual<_Endo<'t>>)= FoldMap.Invoke (_Dual <<_Endo << flip f) t in f.Value.Value z
148
173
149
-
static member inlineFold(x ,f,z,[<Optional>]_impl:Default2)= Seq.fold f z (ToSeq.Invoke x)
150
-
static member inlineFold(x:'F ,f:'b->'a->'b,z:'b,[<Optional>]_impl:Default1)=(^F:(static memberFold:^F->_->_->^b) x, f, z)
151
-
static memberFold(x:option<_>,f,z ,[<Optional>]_impl:Fold )=match x with Some x -> f z x |_-> z
152
-
static memberFold(x:Id<_>,f,z ,[<Optional>]_impl:Fold )= f z x.getValue
153
-
static memberFold(x:seq<_>,f,z ,[<Optional>]_impl:Fold )= Seq.fold f z x
154
-
static memberFold(x:list<_>,f,z ,[<Optional>]_impl:Fold )= List.fold f z x
155
-
static memberFold(x:Set<_>,f,z ,[<Optional>]_impl:Fold )= Set.fold f z x
156
-
static memberFold(x:_ [],f,z ,[<Optional>]_impl:Fold )= Array.fold f z x
174
+
static member inlineFold(x ,f,z,[<Optional>]_impl:Default2)=
175
+
#if TEST_TRACE
176
+
Traces.add "Fold Default"
177
+
#endif
178
+
Seq.fold f z (ToSeq.Invoke x)
179
+
180
+
static member inlineFold(x:'F ,f:'b->'a->'b,z:'b,[<Optional>]_impl:Default1)=(^F:(static memberFold:^F->_->_->^b) x, f, z)
181
+
static memberFold(x:option<_>,f,z ,[<Optional>]_impl:Fold )=match x with Some x -> f z x |_-> z
182
+
static memberFold(x:voption<_>,f,z ,[<Optional>]_impl:Fold )=match x with ValueSome x -> f z x |_-> z
183
+
static memberFold(x:Result<_,_>,f,z ,[<Optional>]_impl:Fold )=match x with Ok x -> f z x |_-> z
184
+
static memberFold(x:Id<_>,f,z ,[<Optional>]_impl:Fold )= f z x.getValue
185
+
static memberFold(x:seq<_>,f,z ,[<Optional>]_impl:Fold )= Seq.fold f z x
186
+
static memberFold(x:list<_>,f,z ,[<Optional>]_impl:Fold )= List.fold f z x
187
+
static memberFold(x:Set<_>,f,z ,[<Optional>]_impl:Fold )= Set.fold f z x
188
+
static memberFold(x:_ [],f,z ,[<Optional>]_impl:Fold )= Array.fold f z x
157
189
158
190
static member inlineInvoke(folder:'State->'T->'State)(state:'State)(foldable:'``Foldable'<T>``):'State =
159
191
let inlinecall_2(a:^a,b:^b,f,z)=((^aor^b):(static memberFold:_*_*_*_->_) b, f, z, a)
@@ -170,7 +202,7 @@ type Exists =
170
202
static memberExists(x:'a [],f ,[<Optional>]_impl:Exists )= Array.exists f x
171
203
static memberExists(x:Set<'a>,f ,[<Optional>]_impl:Exists )= Set.exists f x
172
204
static memberExists(x:'a ResizeArray ,f ,[<Optional>]_impl:Exists )= Seq.exists f x
173
-
static memberExists(x:string ,f ,[<Optional>]_impl:Exists )= String.exists f x
205
+
static memberExists(x:string ,f ,[<Optional>]_impl:Exists )= String.exists f x
174
206
static memberExists(x:StringBuilder ,f ,[<Optional>]_impl:Exists )= x |> string |> String.exists f
175
207
176
208
static member inlineInvoke(predicate:'T->bool)(source:'``Foldable'<T>``)=
@@ -231,6 +263,8 @@ type Head =
231
263
static member inlineHead(x:'``Foldable<'T>``,[<Optional>]_impl:Default2)= Seq.head (ToSeq.Invoke x): 'T
232
264
static member inlineHead(x:'``Foldable<'T>``,[<Optional>]_impl:Default1)=(^``Foldable<'T>``:(memberHead: 'T) x)
0 commit comments