@@ -48,11 +48,12 @@ type ToSeq =
4848 #endif
4949 x
5050
51- static member ToSeq ( x : Text.StringBuilder , _ : ToSeq ) = string x :> seq< char>
52- static member ToSeq ( x : string , _ : ToSeq ) = String.toSeq x
53- static member ToSeq ( x : option < 'T > , [<Optional>] _impl : ToSeq ) = match x with Some x -> Seq.singleton x | _ -> Seq.empty
54- static member ToSeq ( x : voption < 'T >, [<Optional>] _impl : ToSeq ) = match x with ValueSome x -> Seq.singleton x | _ -> Seq.empty
55- static member ToSeq ( x : Id < 'T > , [<Optional>] _impl : ToSeq ) = Seq.singleton x.getValue
51+ static member ToSeq ( x : Text.StringBuilder , _ : ToSeq ) = string x :> seq< char>
52+ static member ToSeq ( x : string , _ : ToSeq ) = String.toSeq x
53+ static member ToSeq ( x : option < 'T > , [<Optional>] _impl : ToSeq ) = match x with Some x -> Seq.singleton x | _ -> Seq.empty
54+ static member ToSeq ( x : voption < 'T > , [<Optional>] _impl : ToSeq ) = match x with ValueSome x -> Seq.singleton x | _ -> Seq.empty
55+ static member ToSeq ( x : Result < 'T , _ >, [<Optional>] _impl : ToSeq ) = match x with Ok x -> Seq.singleton x | _ -> Seq.empty
56+ static member ToSeq ( x : Id < 'T > , [<Optional>] _impl : ToSeq ) = Seq.singleton x.getValue
5657
5758 static member inline Invoke ( source : '``Foldable < 'T > ``) : seq < 'T > =
5859 let inline call_2 ( a : ^a , b : ^b ) = (( ^a or ^b ) : ( static member ToSeq : _*_ -> _) b, a)
@@ -120,6 +121,7 @@ type FoldBack =
120121 static member FoldBack ( x : seq < _ > , f , z , [<Optional>] _impl : FoldBack ) = List.foldBack f ( Seq.toList x) z
121122 static member FoldBack ( x : option < _ > , f , z , [<Optional>] _impl : FoldBack ) = match x with Some x -> f x z | _ -> z
122123 static member FoldBack ( x : voption < _ > , f , z , [<Optional>] _impl : FoldBack ) = match x with ValueSome x -> f x z | _ -> z
124+ static member FoldBack ( x : Result < _ , _ > , f , z , [<Optional>] _impl : FoldBack ) = match x with Ok x -> f x z | _ -> z
123125 static member FoldBack ( x : list < _ > , f , z , [<Optional>] _impl : FoldBack ) = List.foldBack f x z
124126 static member FoldBack ( x : _ [] , f , z , [<Optional>] _impl : FoldBack ) = Array.foldBack f x z
125127 static member FoldBack ( x : Set < _ > , f , z , [<Optional>] _impl : FoldBack ) = Set.foldBack f x z
@@ -139,11 +141,12 @@ type FoldMap =
139141
140142 static member inline FromFoldFoldBack f x = FoldBack.Invoke ( Plus.Invoke << f) ( Zero.Invoke ()) x
141143
142- static member inline FoldMap ( x : option < _ > , f , [<Optional>] _impl : FoldMap ) = match x with Some x -> f x | _ -> Zero.Invoke ()
143- static member inline FoldMap ( x : voption < _ >, f , [<Optional>] _impl : FoldMap ) = match x with ValueSome x -> f x | _ -> Zero.Invoke ()
144- static member inline FoldMap ( x : list < _ > , f , [<Optional>] _impl : FoldMap ) = List.fold ( fun x y -> Plus.Invoke x ( f y)) ( Zero.Invoke ()) x
145- static member inline FoldMap ( x : Set < _ > , f , [<Optional>] _impl : FoldMap ) = Seq.fold ( fun x y -> Plus.Invoke x ( f y)) ( Zero.Invoke ()) x
146- static member inline FoldMap ( x : _ [] , f , [<Optional>] _impl : FoldMap ) = Array.fold ( fun x y -> Plus.Invoke x ( f y)) ( Zero.Invoke ()) x
144+ static member inline FoldMap ( x : option < _ > , f , [<Optional>] _impl : FoldMap ) = match x with Some x -> f x | _ -> Zero.Invoke ()
145+ static member inline FoldMap ( x : voption < _ > , f , [<Optional>] _impl : FoldMap ) = match x with ValueSome x -> f x | _ -> Zero.Invoke ()
146+ static member inline FoldMap ( x : Result < _ , _ >, f , [<Optional>] _impl : FoldMap ) = match x with Ok x -> f x | _ -> Zero.Invoke ()
147+ static member inline FoldMap ( x : list < _ > , f , [<Optional>] _impl : FoldMap ) = List.fold ( fun x y -> Plus.Invoke x ( f y)) ( Zero.Invoke ()) x
148+ static member inline FoldMap ( x : Set < _ > , f , [<Optional>] _impl : FoldMap ) = Seq.fold ( fun x y -> Plus.Invoke x ( f y)) ( Zero.Invoke ()) x
149+ static member inline FoldMap ( x : _ [] , f , [<Optional>] _impl : FoldMap ) = Array.fold ( fun x y -> Plus.Invoke x ( f y)) ( Zero.Invoke ()) x
147150
148151 static member inline Invoke ( f : 'T -> 'Monoid ) ( x : '``Foldable' < T > ``) : 'Monoid =
149152 let inline call_2 ( a : ^a , b : ^b , f ) = (( ^a or ^b ) : ( static member FoldMap : _*_*_ -> _) b, f, a)
@@ -174,14 +177,15 @@ type Fold =
174177 #endif
175178 Seq.fold f z ( ToSeq.Invoke x)
176179
177- static member inline Fold ( x : 'F , f : 'b -> 'a -> 'b , z : 'b , [<Optional>] _impl : Default1 ) = ( ^F : ( static member Fold : ^F -> _ -> _ -> ^b ) x, f, z)
178- static member Fold ( x : option < _ > , f , z , [<Optional>] _impl : Fold ) = match x with Some x -> f z x | _ -> z
179- static member Fold ( x : voption < _ >, f , z , [<Optional>] _impl : Fold ) = match x with ValueSome x -> f z x | _ -> z
180- static member Fold ( x : Id < _ > , f , z , [<Optional>] _impl : Fold ) = f z x.getValue
181- static member Fold ( x : seq < _ > , f , z , [<Optional>] _impl : Fold ) = Seq.fold f z x
182- static member Fold ( x : list < _ > , f , z , [<Optional>] _impl : Fold ) = List.fold f z x
183- static member Fold ( x : Set < _ > , f , z , [<Optional>] _impl : Fold ) = Set.fold f z x
184- static member Fold ( x : _ [] , f , z , [<Optional>] _impl : Fold ) = Array.fold f z x
180+ static member inline Fold ( x : 'F , f : 'b -> 'a -> 'b , z : 'b , [<Optional>] _impl : Default1 ) = ( ^F : ( static member Fold : ^F -> _ -> _ -> ^b ) x, f, z)
181+ static member Fold ( x : option < _ > , f , z , [<Optional>] _impl : Fold ) = match x with Some x -> f z x | _ -> z
182+ static member Fold ( x : voption < _ > , f , z , [<Optional>] _impl : Fold ) = match x with ValueSome x -> f z x | _ -> z
183+ static member Fold ( x : Result < _ , _ >, f , z , [<Optional>] _impl : Fold ) = match x with Ok x -> f z x | _ -> z
184+ static member Fold ( x : Id < _ > , f , z , [<Optional>] _impl : Fold ) = f z x.getValue
185+ static member Fold ( x : seq < _ > , f , z , [<Optional>] _impl : Fold ) = Seq.fold f z x
186+ static member Fold ( x : list < _ > , f , z , [<Optional>] _impl : Fold ) = List.fold f z x
187+ static member Fold ( x : Set < _ > , f , z , [<Optional>] _impl : Fold ) = Set.fold f z x
188+ static member Fold ( x : _ [] , f , z , [<Optional>] _impl : Fold ) = Array.fold f z x
185189
186190 static member inline Invoke ( folder : 'State -> 'T -> 'State ) ( state : 'State ) ( foldable : '``Foldable' < T > ``) : 'State =
187191 let inline call_2 ( a : ^a , b : ^b , f , z ) = (( ^a or ^b ) : ( static member Fold : _*_*_*_ -> _) b, f, z, a)
@@ -198,7 +202,7 @@ type Exists =
198202 static member Exists ( x : 'a [] , f , [<Optional>] _impl : Exists ) = Array.exists f x
199203 static member Exists ( x : Set < 'a > , f , [<Optional>] _impl : Exists ) = Set.exists f x
200204 static member Exists ( x : 'a ResizeArray , f , [<Optional>] _impl : Exists ) = Seq.exists f x
201- static member Exists ( x : string , f , [<Optional>] _impl : Exists ) = String.exists f x
205+ static member Exists ( x : string , f , [<Optional>] _impl : Exists ) = String.exists f x
202206 static member Exists ( x : StringBuilder , f , [<Optional>] _impl : Exists ) = x |> string |> String.exists f
203207
204208 static member inline Invoke ( predicate : 'T -> bool ) ( source : '``Foldable' < T > ``) =
@@ -260,6 +264,7 @@ type Head =
260264 static member inline Head ( x : '``Foldable < 'T > ``, [<Optional>] _impl : Default1 ) = (^ `` Foldable<'T> `` : ( member Head : 'T) x)
261265 static member Head ( x : 'T option , [<Optional>] _impl : Head ) = x.Value
262266 static member Head ( x : 'T voption , [<Optional>] _impl : Head ) = x.Value
267+ static member Head ( x : Result < _ , _ > , [<Optional>] _impl : Head ) = Result.get x
263268 static member Head ( x : 'T [] , [<Optional>] _impl : Head ) = x.[ 0 ]
264269 static member Head ( x : NonEmptySeq < 'T > , [<Optional>] _impl : Head ) = x.First
265270 static member Head ( x : Id < 'T > , [<Optional>] _impl : Head ) = x.getValue
@@ -420,6 +425,7 @@ type Length =
420425 static member Length ( x : 'T list , [<Optional>] _impl : Length ) = List.length x
421426 static member Length ( x : option < 'T > , [<Optional>] _impl : Length ) = if x.IsSome then 1 else 0
422427 static member Length ( x : voption < 'T > , [<Optional>] _impl : Length ) = if x.IsSome then 1 else 0
428+ static member Length ( x : vResult < _ , _ > , [<Optional>] _impl : Length ) = if x.IsOk then 1 else 0
423429 static member Length ( x : 'T [] , [<Optional>] _impl : Length ) = Array.length x
424430
425431 static member inline Invoke ( source : '``Foldable < 'T > ``) =
0 commit comments