Skip to content

Commit 96b41ef

Browse files
committed
Add forward/backward zip-applicatives to Compose
1 parent 7abcad2 commit 96b41ef

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/FSharpPlus/Data/Compose.fs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,20 @@ type Compose<'``functorF<'functorG<'t>>``> = Compose of '``functorF<'functorG<'t
5656
static member inline (<.>) (Compose (f: '``ApplicativeF<'ApplicativeG<'T -> 'U>``), Compose (x: '``ApplicativeF<'ApplicativeG<'T>``)) =
5757
Compose ((((<.>) : '``ApplicativeG<'T -> 'U>`` -> '``ApplicativeG<'T>`` -> '``ApplicativeG<'U>``) <!> f: '``ApplicativeF<'ApplicativeG<'T> -> 'ApplicativeG<'U>`` ) <.> x: '``ApplicativeF<'ApplicativeG<'U>``)
5858

59+
/// <summary>
60+
/// Applies two composed applicatives left-to-right in a non-sequential way, discarding the value of the first argument.
61+
/// </summary>
62+
/// <category index="2">Applicative</category>
63+
static member inline ( .>) (Compose (x: '``FunctorF<'FunctorG<'T>>``), Compose (y: '``FunctorF<'FunctorG<'U>>``)) : Compose<'``FunctorF<'FunctorG<'U>>``> =
64+
(ZipApply.Invoke << Map.Invoke (ZipApply.Invoke << Map.Invoke (fun _ k -> k))) x y |> Compose
65+
66+
/// <summary>
67+
/// Applies two composed applicatives left-to-right in a non-sequential way, discarding the value of the second argument.
68+
/// </summary>
69+
/// <category index="2">Applicative</category>
70+
static member inline (<. ) (Compose (x: '``FunctorF<'FunctorG<'U>>``), Compose (y: '``FunctorF<'FunctorG<'T>>``)) : Compose<'``FunctorF<'FunctorG<'U>>``> =
71+
(ZipApply.Invoke << Map.Invoke (ZipApply.Invoke << Map.Invoke (fun k _ -> k))) x y |> Compose
72+
5973
static member inline Map2 (f: 'T -> 'U -> 'V, Compose (x: '``ApplicativeF<'ApplicativeG<'T>``), Compose (y: '``ApplicativeF<'ApplicativeG<'U>``)) =
6074
Compose (Map2.Invoke (Map2.Invoke f: '``ApplicativeG<'T>`` -> '``ApplicativeG<'U>`` -> '``ApplicativeG<'V>``) x y: '``ApplicativeF<'ApplicativeG<'V>``)
6175

0 commit comments

Comments
 (0)