Skip to content

Commit

Permalink
Tuple only input arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
gusty committed Nov 25, 2023
1 parent 25baab4 commit 029ed98
Showing 1 changed file with 30 additions and 29 deletions.
59 changes: 30 additions & 29 deletions src/FSharpPlus/Control/Applicative.fs
Original file line number Diff line number Diff line change
Expand Up @@ -13,60 +13,60 @@ open FSharpPlus.Data

type Apply =
inherit Default1

#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4

static member ``<*>`` ((f: Lazy<'T->'U> , x: Lazy<'T> , _output: Lazy<'U> ) , [<Optional>]_mthd: Apply) = Lazy.apply f x : Lazy<'U>
static member ``<*>`` ((f: seq<_> , x: seq<'T> , _output: seq<'U> ) , [<Optional>]_mthd: Apply) = Seq.apply f x : seq<'U>
static member ``<*>`` ((f: NonEmptySeq<_> , x: NonEmptySeq<'T> , _output: NonEmptySeq<'U> ) , [<Optional>]_mthd: Apply) = NonEmptySeq.apply f x : NonEmptySeq<'U>
static member ``<*>`` ((f: IEnumerator<_> , x: IEnumerator<'T> , _output: IEnumerator<'U> ) , [<Optional>]_mthd: Apply) = Enumerator.map2 id f x : IEnumerator<'U>
static member ``<*>`` ((f: list<_> , x: list<'T> , _output: list<'U> ) , [<Optional>]_mthd: Apply) = List.apply f x : list<'U>
static member ``<*>`` ((f: _ [] , x: 'T [] , _output: 'U [] ) , [<Optional>]_mthd: Apply) = Array.apply f x : 'U []
static member ``<*>`` ((f: 'r -> _ , g: _ -> 'T , _output: 'r -> 'U ) , [<Optional>]_mthd: Apply) = fun x -> let f' = f x in f' (g x) : 'U
static member inline ``<*>`` (((a: 'Monoid, f) , (b: 'Monoid, x: 'T) , _output: 'Monoid * 'U ) , [<Optional>]_mthd: Apply) = (Plus.Invoke a b, f x) : 'Monoid *'U
static member inline ``<*>`` ((struct (a: 'Monoid, f), struct (b: 'Monoid, x: 'T), _output: struct ('Monoid * 'U)), [<Optional>]_mthd: Apply) = struct (Plus.Invoke a b, f x) : struct ('Monoid * 'U)
static member ``<*>`` ((f: Lazy<'T->'U> , x: Lazy<'T> ) , _output: Lazy<'U> , [<Optional>]_mthd: Apply) = Lazy.apply f x : Lazy<'U>
static member ``<*>`` ((f: seq<_> , x: seq<'T> ) , _output: seq<'U> , [<Optional>]_mthd: Apply) = Seq.apply f x : seq<'U>
static member ``<*>`` ((f: NonEmptySeq<_> , x: NonEmptySeq<'T> ) , _output: NonEmptySeq<'U> , [<Optional>]_mthd: Apply) = NonEmptySeq.apply f x : NonEmptySeq<'U>
static member ``<*>`` ((f: IEnumerator<_> , x: IEnumerator<'T> ) , _output: IEnumerator<'U> , [<Optional>]_mthd: Apply) = Enumerator.map2 id f x : IEnumerator<'U>
static member ``<*>`` ((f: list<_> , x: list<'T> ) , _output: list<'U> , [<Optional>]_mthd: Apply) = List.apply f x : list<'U>
static member ``<*>`` ((f: _ [] , x: 'T [] ) , _output: 'U [] , [<Optional>]_mthd: Apply) = Array.apply f x : 'U []
static member ``<*>`` ((f: 'r -> _ , g: _ -> 'T ) , _output: 'r -> 'U , [<Optional>]_mthd: Apply) = fun x -> let f' = f x in f' (g x) : 'U
static member inline ``<*>`` (((a: 'Monoid, f) , (b: 'Monoid, x: 'T) ) , _output: 'Monoid * 'U , [<Optional>]_mthd: Apply) = (Plus.Invoke a b, f x) : 'Monoid *'U
static member inline ``<*>`` ((struct (a: 'Monoid, f), struct (b: 'Monoid, x: 'T)), _output: struct ('Monoid * 'U), [<Optional>]_mthd: Apply) = struct (Plus.Invoke a b, f x) : struct ('Monoid * 'U)
#if !FABLE_COMPILER
static member ``<*>`` ((f: Task<_> , x: Task<'T> , _output: Task<'U> ) , [<Optional>]_mthd: Apply) = Task.apply f x : Task<'U>
static member ``<*>`` ((f: Task<_> , x: Task<'T> ), _output: Task<'U> , [<Optional>]_mthd: Apply) = Task.apply f x : Task<'U>
#endif
#if !NET45 && !NETSTANDARD2_0 && !FABLE_COMPILER
static member ``<*>`` ((f: ValueTask<_> , x: ValueTask<'T> , _output: ValueTask<'U> ) , [<Optional>]_mthd: Apply) = ValueTask.apply f x : ValueTask<'U>
static member ``<*>`` ((f: ValueTask<_> , x: ValueTask<'T> ), _output: ValueTask<'U> , [<Optional>]_mthd: Apply) = ValueTask.apply f x : ValueTask<'U>
#endif
static member ``<*>`` ((f: Async<_> , x: Async<'T> , _output: Async<'U> ) , [<Optional>]_mthd: Apply) = Async.apply f x : Async<'U>
static member ``<*>`` ((f: option<_> , x: option<'T> , _output: option<'U> ) , [<Optional>]_mthd: Apply) = Option.apply f x : option<'U>
static member ``<*>`` ((f: voption<_> , x: voption<'T> , _output: voption<'U> ) , [<Optional>]_mthd: Apply) = ValueOption.apply f x : voption<'U>
static member ``<*>`` ((f: Result<_,'E> , x: Result<'T,'E> , _output: Result<'b,'E> ) , [<Optional>]_mthd: Apply) = Result.apply f x : Result<'U,'E>
static member ``<*>`` ((f: Choice<_,'E> , x: Choice<'T,'E> , _output: Choice<'b,'E> ) , [<Optional>]_mthd: Apply) = Choice.apply f x : Choice<'U,'E>
static member inline ``<*>`` ((KeyValue(a: 'Key, f), KeyValue(b: 'Key, x: 'T), _output: KeyValuePair<'Key,'U>), [<Optional>]_mthd: Apply) : KeyValuePair<'Key,'U> = KeyValuePair (Plus.Invoke a b, f x)
static member inline ``<*>`` ((f: KeyValuePair2<'Key, _>, x: KeyValuePair2<'Key, 'T>, _output: KeyValuePair2<'Key,'U>), [<Optional>]_mthd: Apply) : KeyValuePair2<'Key,'U> =
static member ``<*>`` ((f: Async<_> , x: Async<'T> ), _output: Async<'U> , [<Optional>]_mthd: Apply) = Async.apply f x : Async<'U>
static member ``<*>`` ((f: option<_> , x: option<'T> ), _output: option<'U> , [<Optional>]_mthd: Apply) = Option.apply f x : option<'U>
static member ``<*>`` ((f: voption<_> , x: voption<'T> ), _output: voption<'U> , [<Optional>]_mthd: Apply) = ValueOption.apply f x : voption<'U>
static member ``<*>`` ((f: Result<_,'E> , x: Result<'T,'E> ), _output: Result<'b,'E> , [<Optional>]_mthd: Apply) = Result.apply f x : Result<'U,'E>
static member ``<*>`` ((f: Choice<_,'E> , x: Choice<'T,'E> ), _output: Choice<'b,'E> , [<Optional>]_mthd: Apply) = Choice.apply f x : Choice<'U,'E>
static member inline ``<*>`` ((KeyValue(a: 'Key, f), KeyValue(b: 'Key, x: 'T)), _output: KeyValuePair<'Key,'U>, [<Optional>]_mthd: Apply) : KeyValuePair<'Key,'U> = KeyValuePair (Plus.Invoke a b, f x)
static member inline ``<*>`` ((f: KeyValuePair2<'Key, _>, x: KeyValuePair2<'Key, 'T>), _output: KeyValuePair2<'Key,'U>, [<Optional>]_mthd: Apply) : KeyValuePair2<'Key,'U> =
let a = f.Key
let b = x.Key
let f = f.Value
let x = x.Value
KeyValuePair2 (Plus.Invoke a b, f x)

static member ``<*>`` ((f: Map<'Key,_> , x: Map<'Key,'T> , _output: Map<'Key,'U> ) , [<Optional>]_mthd: Apply) : Map<'Key,'U> = Map (seq {
static member ``<*>`` ((f: Map<'Key,_> , x: Map<'Key,'T> ) , _output: Map<'Key,'U> , [<Optional>]_mthd: Apply) : Map<'Key,'U> = Map (seq {
for KeyValue(k, vf) in f do
match Map.tryFind k x with
| Some vx -> yield k, vf vx
| _ -> () })

static member ``<*>`` ((f: Dictionary<'Key,_>, x: Dictionary<'Key,'T> , _output: Dictionary<'Key,'U> ) , [<Optional>]_mthd: Apply) : Dictionary<'Key,'U> =
static member ``<*>`` ((f: Dictionary<'Key,_>, x: Dictionary<'Key,'T>) , _output: Dictionary<'Key,'U> , [<Optional>]_mthd: Apply) : Dictionary<'Key,'U> =
let dct = Dictionary ()
for KeyValue(k, vf) in f do
match x.TryGetValue k with
| true, vx -> dct.Add (k, vf vx)
| _ -> ()
dct

static member ``<*>`` ((f: IDictionary<'Key,_>, x: IDictionary<'Key,'T> , _output: IDictionary<'Key,'U> ) , [<Optional>]_mthd: Apply) : IDictionary<'Key,'U> =
static member ``<*>`` ((f: IDictionary<'Key,_>, x: IDictionary<'Key,'T>) , _output: IDictionary<'Key,'U> , [<Optional>]_mthd: Apply) : IDictionary<'Key,'U> =
let dct = Dictionary ()
for KeyValue(k, vf) in f do
match x.TryGetValue k with
| true, vx -> dct.Add (k, vf vx)
| _ -> ()
dct :> IDictionary<'Key,'U>

static member ``<*>`` ((f: IReadOnlyDictionary<'Key,_>, x: IReadOnlyDictionary<'Key,'T> , _output: IReadOnlyDictionary<'Key,'U> ) , [<Optional>]_mthd: Apply) : IReadOnlyDictionary<'Key,'U> =
static member ``<*>`` ((f: IReadOnlyDictionary<'Key,_>, x: IReadOnlyDictionary<'Key,'T>) , _output: IReadOnlyDictionary<'Key,'U> , [<Optional>]_mthd: Apply) : IReadOnlyDictionary<'Key,'U> =
let dct = Dictionary ()
for KeyValue(k, vf) in f do
match x.TryGetValue k with
Expand All @@ -75,13 +75,13 @@ type Apply =
dct :> IReadOnlyDictionary<'Key,'U>

#if !FABLE_COMPILER
static member ``<*>`` ((f: Expr<'T->'U>, x: Expr<'T>, _output: Expr<'U>), [<Optional>]_mthd: Apply) = Expr.Cast<'U> (Expr.Application (f, x))
static member ``<*>`` ((f: Expr<'T->'U>, x: Expr<'T>), _output: Expr<'U>, [<Optional>]_mthd: Apply) = Expr.Cast<'U> (Expr.Application (f, x))
#endif
static member ``<*>`` ((f: ('T->'U) ResizeArray, x: 'T ResizeArray, _output: 'U ResizeArray), [<Optional>]_mthd: Apply) = ResizeArray.apply f x : 'U ResizeArray
static member ``<*>`` ((f: ('T->'U) ResizeArray, x: 'T ResizeArray), _output: 'U ResizeArray, [<Optional>]_mthd: Apply) = ResizeArray.apply f x : 'U ResizeArray

static member inline Invoke (f: '``Applicative<'T -> 'U>``) (x: '``Applicative<'T>``) : '``Applicative<'U>`` =
let inline call (mthd : ^M, input1: ^I1, input2: ^I2, output: ^R) =
((^M or ^I1 or ^I2 or ^R) : (static member ``<*>`` : (_*_*_)*_ -> _) (input1, input2, output), mthd)
((^M or ^I1 or ^I2 or ^R) : (static member ``<*>`` : (_*_)*_*_ -> _) (input1, input2), output, mthd)
call(Unchecked.defaultof<Apply>, f, x, Unchecked.defaultof<'``Applicative<'U>``>)


Expand All @@ -93,9 +93,10 @@ type Apply =
#if (!FABLE_COMPILER || FABLE_COMPILER_3) && !FABLE_COMPILER_4

type Apply with
static member inline ``<*>`` ((f: '``Monad<'T->'U>`` , x: '``Monad<'T>`` , _output: '``Monad<'U>`` ), [<Optional>]_mthd:Default2) : '``Monad<'U>`` = Bind.InvokeOnInstance f (fun (x1: 'T->'U) -> Bind.InvokeOnInstance x (fun x2 -> Return.InvokeOnInstance (x1 x2)))
static member inline ``<*>`` ((_: ^t when ^t : null and ^t: struct, _: ^u when ^u : null and ^u: struct, _output: ^r when ^r : null and ^r: struct), _mthd: Default1) = id
static member inline ``<*>`` ((f: '``Applicative<'T->'U>``, x: '``Applicative<'T>``, _output: '``Applicative<'U>``), [<Optional>]_mthd:Default1) : '``Applicative<'U>`` = ((^``Applicative<'T->'U>`` or ^``Applicative<'T>`` or ^``Applicative<'U>``) : (static member (<*>) : _*_ -> _) f, x)
static member inline ``<*>`` ((f: '``Monad<'T->'U>`` , x: '``Monad<'T>`` ) , _output: '``Monad<'U>`` , [<Optional>]_mthd:Default2) : '``Monad<'U>`` = Bind.InvokeOnInstance f (fun (x1: 'T->'U) -> Bind.InvokeOnInstance x (fun x2 -> Return.InvokeOnInstance (x1 x2)))
static member inline ``<*>`` ((_: ^t when ^t : null and ^t: struct, _: ^u when ^u : null and ^u: struct), _output: ^r when ^r : null and ^r: struct, _mthd: Default1) = id

static member inline ``<*>`` ((f: '``Applicative<'T->'U>``, x: '``Applicative<'T>``), _output: '``Applicative<'U>``, [<Optional>]_mthd: Default1) : '``Applicative<'U>`` = ((^``Applicative<'T->'U>`` or ^``Applicative<'T>`` or ^``Applicative<'U>``) : (static member (<*>) : _*_ -> _) f, x)


type Lift2 =
Expand Down

0 comments on commit 029ed98

Please sign in to comment.