Skip to content

Commit f646f98

Browse files
Add support for ValueTuple (#524)
1 parent 3c05e4b commit f646f98

21 files changed

+80
-4
lines changed

docsrc/content/abstraction-applicative.fsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ From F#
6666
- ``Choice<'T,'U>``
6767
- ``KeyValuePair<'Key,'T>``
6868
- ``'Monoid * 'T``
69+
- ``'ValueTuple<Monoid, 'T>``
6970
- ``Task<'T>``
7071
- ``ValueTask<'T>``
7172
- ``'R->'T``

docsrc/content/abstraction-bifoldable.fsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ Concrete implementations
7878
From .Net/F#
7979
8080
- ``'T * 'U``
81+
- ``struct ('T * 'U)``
8182
- ``Result<'T,'U>``
8283
- ``Choice<'T,'U>``
8384

docsrc/content/abstraction-bifunctor.fsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ Concrete implementations of Bifunctor<'T1,'T2>
6767
From .Net/F#
6868
6969
- ``'T1 * 'T2``
70+
- ``struct ('T1 * 'T2)``
7071
- ``Result<'T2,'T1>``
7172
- ``Choice<'T2,'T1>``
7273
- ``KeyValuePair<'T1,'T2>``

docsrc/content/abstraction-bitraversable.fsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ Concrete implementations
5353
From .Net/F#
5454
5555
- ``'T * 'U``
56+
- ``struct ('T * 'U)``
5657
- ``Result<'T,'U>``
5758
- ``Choice<'T,'U>``
5859

docsrc/content/abstraction-comonad.fsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ From .Net/F#
6666
- ``Lazy<'T>``
6767
- ``Id<'T>``
6868
- ``('W * 'T)``
69+
- ``struct ('W * 'T)``
6970
- ``'Monoid -> 'T``
7071
- ``ValueTask<'T>``
7172

docsrc/content/abstraction-functor.fsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ From F#
5757
- ``KeyValuePair<'Key,'T>``
5858
- ``Map<'Key,'T>``
5959
- ``'Monoid * 'T``
60+
- ``'struct ('Monoid * 'T)``
6061
- ``Task<'T>``
6162
- ``ValueTask<'T>``
6263
- ``'R->'T``

docsrc/content/abstraction-monad.fsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ From F#
7474
- ``Result<'T,'U>``
7575
- ``Choice<'T,'U>``
7676
- ``'Monoid * 'T``
77+
- ``struct ('Monoid * 'T)``
7778
- ``Task<'T>``
7879
- ``ValueTask<'T>``
7980
- ``'R->'T``

docsrc/content/abstraction-semigroup.fsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ From .Net/F#
4242
- ``Map<'T,'U>``
4343
- ``TimeSpan``
4444
- ``Tuple<*>``
45+
- ``ValueTuple<*> ( * up to 7 elements)``
4546
- ``'T1* ... *'Tn``
4647
- ``Task<'T>``
4748
- ``ValueTask<'T>``

src/FSharpPlus/Control/Applicative.fs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ type Apply =
2727
static member ``<*>`` (f: _ [] , x: 'T [] , [<Optional>]_output: 'U [] , [<Optional>]_mthd: Apply) = Array.apply f x : 'U []
2828
static member ``<*>`` (f: 'r -> _ , g: _ -> 'T , [<Optional>]_output: 'r -> 'U , [<Optional>]_mthd: Apply) = fun x -> let f' = f x in f' (g x) : 'U
2929
static member inline ``<*>`` ((a: 'Monoid, f) , (b: 'Monoid, x: 'T) , [<Optional>]_output: 'Monoid * 'U , [<Optional>]_mthd: Apply) = (Plus.Invoke a b, f x) : 'Monoid *'U
30+
static member inline ``<*>`` (struct (a: 'Monoid, f), struct (b: 'Monoid, x: 'T), [<Optional>]_output: struct ('Monoid * 'U), [<Optional>]_mthd: Apply) = struct (Plus.Invoke a b, f x) : struct ('Monoid * 'U)
3031
#if !FABLE_COMPILER
3132
static member ``<*>`` (f: Task<_> , x: Task<'T> , [<Optional>]_output: Task<'U> , [<Optional>]_mthd: Apply) = Task.apply f x : Task<'U>
3233
#endif
@@ -82,6 +83,7 @@ type Lift2 =
8283
static member Lift2 (f, (x , y ), _mthd: Lift2) = Array.lift2 f x y
8384
static member Lift2 (f, (x: 'R -> 'T , y: 'R -> 'U ), _mthd: Lift2) = fun a -> f (x a) (y a)
8485
static member inline Lift2 (f, ((a: 'Monoid, x: 'T) , (b: 'Monoid, y: 'U) ), _mthd: Lift2) = Plus.Invoke a b, f x y
86+
static member inline Lift2 (f, (struct (a: 'Monoid, x: 'T), struct (b: 'Monoid, y: 'U)), _mthd: Lift2) = struct (Plus.Invoke a b, f x y)
8587
#if !FABLE_COMPILER
8688
static member Lift2 (f, (x: Task<'T> , y: Task<'U> ), _mthd: Lift2) = Task.map2 f x y
8789
#endif

src/FSharpPlus/Control/Bifoldable.fs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ type BifoldMap =
1212
static member BifoldMap (x: Result<'T2,'T1>, f, g, _impl: BifoldMap) = match x with Error x -> f x | Ok x -> g x : 'U
1313
static member BifoldMap (x: Choice<'T2,'T1>, f, g, _impl: BifoldMap) = match x with Choice2Of2 x -> f x | Choice1Of2 x -> g x : 'U
1414
static member inline BifoldMap ((x: 'T1, y: 'T2) , f, g, _impl: BifoldMap) = Plus.Invoke (f x) (g y) : 'U
15+
static member inline BifoldMap (struct (x: 'T1, y: 'T2), f, g, _impl: BifoldMap) = Plus.Invoke (f x) (g y) : 'U
1516

1617
static member inline Invoke (f: 'T1->'U) (g: 'T2->'U) (source: '``Bifoldable<T1,T2>``) : 'U =
1718
let inline call (a: ^a, b: ^b) = ((^a or ^b) : (static member BifoldMap : _*_*_*_ -> _) b,f,g,a)
@@ -30,6 +31,7 @@ type Bifold =
3031
static member inline Bifold (x: Result<'T2,'T1>, f: 'S->'T1->'S, g : 'S->'T2->'S, z: 'S, _impl: Bifold) = match x with Error x -> f z x | Ok x -> g z x
3132
static member inline Bifold (x: Choice<'T2,'T1>, f: 'S->'T1->'S, g : 'S->'T2->'S, z: 'S, _impl: Bifold) = match x with Choice2Of2 x -> f z x | Choice1Of2 x -> g z x
3233
static member inline Bifold ((x: 'T1, y: 'T2) , f: 'S->'T1->'S, g : 'S->'T2->'S, z: 'S, _impl: Bifold) = g (f z x) y
34+
static member inline Bifold (struct (x: 'T1, y: 'T2), f: 'S -> 'T1 -> 'S, g : 'S -> 'T2 -> 'S, z: 'S, _impl: Bifold) = g (f z x) y
3335

3436
static member inline Invoke (f: 'S->'T1->'S) (g: 'S->'T2->'S) (z: 'S) (source: '``Bifoldable<'T1,'T2>``) : 'S =
3537
let inline call (a: ^a, b: ^b) = ((^a or ^b) : (static member Bifold : _*_*_*_*_ -> _) b,f,g,z,a)
@@ -48,6 +50,7 @@ type BifoldBack =
4850
static member inline BifoldBack (x: Result<'T2,'T1>, f: 'T1->'S->'S, g : 'T2->'S->'S, z: 'S, _impl: BifoldBack) = match x with Error x -> f x z | Ok x -> g x z
4951
static member inline BifoldBack (x: Choice<'T2,'T1>, f: 'T1->'S->'S, g : 'T2->'S->'S, z: 'S, _impl: BifoldBack) = match x with Choice2Of2 x -> f x z | Choice1Of2 x -> g x z
5052
static member inline BifoldBack ((x: 'T1, y: 'T2) , f: 'T1->'S->'S, g : 'T2->'S->'S, z: 'S, _impl: BifoldBack) = (f x (g y z))
53+
static member inline BifoldBack (struct (x: 'T1, y: 'T2), f: 'T1 -> 'S -> 'S, g : 'T2 -> 'S -> 'S, z: 'S, _impl: BifoldBack) = (f x (g y z))
5154

5255
static member inline Invoke (f: 'T1->'S->'S) (g: 'T2->'S->'S) (z: 'S) (source: '``Bifoldable<'T1,'T2>``) : 'S =
5356
let inline call (a: ^a, b: ^b) = ((^a or ^b) : (static member BifoldBack : _*_*_*_*_ -> _) b,f,g,z,a)
@@ -66,6 +69,7 @@ type Bisum =
6669
static member Bisum (x: Result<_,_>, _impl: Bisum) = match x with Ok x -> x | Error x -> x
6770
static member Bisum (x: Choice<_,_>, _impl: Bisum) = match x with Choice1Of2 x -> x | Choice2Of2 x -> x
6871
static member inline Bisum ((x,y) , _impl: Bisum) = Plus.Invoke x y
72+
static member inline Bisum (struct (x, y) , _impl: Bisum) = Plus.Invoke x y
6973

7074
static member inline Invoke (source: '``Bifoldable<'T1,'T2>``) : 'U =
7175
let inline call (a: ^a, b: ^b) = ((^a or ^b) : (static member Bisum : _*_ -> _) b,a)

0 commit comments

Comments
 (0)