Skip to content

Commit 7abcad2

Browse files
committed
Add 2 layer forward applicative variations
1 parent 9544fff commit 7abcad2

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

src/FSharpPlus/Operators.fs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,29 @@ module Operators =
270270
/// <category index="2">Applicative</category>
271271
let inline (<.) (x: '``ZipApplicative<'U>``) (y: '``ZipApplicative<'T>``) : '``ZipApplicative<'U>`` = ((fun (k: 'U) (_: 'T) -> k ) <!> x : '``ZipApplicative<'T->'U>``) <.> y
272272

273+
/// <summary>
274+
/// Sequences two nested applicatives left-to-right, discarding the value of the first argument.
275+
/// </summary>
276+
/// <category index="2">Applicative</category>
277+
let inline ( **>) (x: '``Applicative1<Applicative2<'T>>``) (y: '``Applicative1<Applicative2<'U>>``) : '``Applicative1<Applicative2<'U>>`` = (Map.Invoke ( *>) x) <*> y
278+
279+
/// <summary>
280+
/// Applies two nested applicatives left-to-right, discarding the value of the first argument.
281+
/// The outer applicative is non-sequential (zip-like), while the inner one is sequential.
282+
/// </summary>
283+
let inline ( .*>) (x: '``ZipApplicative<Applicative<'T>>``) (y: '``ZipApplicative<Applicative<'U>>``) : '``ZipApplicative1<Applicative<'U>>`` = (Map.Invoke ( *>) x) <.> y
284+
285+
/// <summary>
286+
/// Applies two nested applicatives left-to-right, discarding the value of the first argument.
287+
/// The outer applicative is sequential, while the inner one is non-sequential (zip-like).
288+
/// </summary>
289+
let inline ( *.>) (x: '``Applicative<ZipApplicative<'T>>``) (y: '``Applicative1<ZipApplicative<'U>>``) : '``Applicative1<ZipApplicative<'U>>`` = (Map.Invoke ( .>) x) <*> y
290+
291+
/// <summary>
292+
/// Applies two nested applicatives left-to-right in a non-sequential way, discarding the value of the first argument.
293+
/// </summary>
294+
let inline ( ..>) (x: '``ZipApplicative1<ZipApplicative2<'T>>``) (y: '``ZipApplicative1<ZipApplicative2<'U>>``) : '``ZipApplicative1<ZipApplicative2<'U>>`` = (Map.Invoke ( .>) x) <.> y
295+
273296
/// <summary>
274297
/// Applies 2 lifted arguments to a non-lifted function with pointwise and/or parallel semantics.
275298
/// Operator version of 'map2'.

0 commit comments

Comments
 (0)