Skip to content

Commit 44ebc37

Browse files
committed
Add (|!>) operators
These operators (|!>) and (<!|) ideally should be called (!>) and (<!) but the problem is that (!>) is unary and it turns out it will be the most used of the 2, because it's in the direction of typical F# pipes.
1 parent 41866b8 commit 44ebc37

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/FSharpPlus/Operators.fs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,18 @@ module Operators =
174174
/// <category index="1">Functor</category>
175175
let inline iter (action: 'T->unit) (source: '``Functor<'T>``) : unit = Iterate.Invoke action source
176176

177+
/// <summary>
178+
/// Replaces a functor value with the supplied one, ignoring the original value.
179+
/// </summary>
180+
/// <category index="1">Functor</category>
181+
let inline (|!>) (source: '``Functor<'T>``) (value: 'U) : '``Functor<'U>`` = Map.Invoke (fun _ -> value) source
182+
183+
/// <summary>
184+
/// Replaces a functor value with the supplied one, ignoring the original value.
185+
/// </summary>
186+
/// <category index="1">Functor</category>
187+
let inline (<!|) (value: 'U) (source: '``Functor<'T>``) : '``Functor<'U>`` = Map.Invoke (fun _ -> value) source
188+
177189
/// <summary>
178190
/// Un-zips (un-tuple) two functors.
179191
/// </summary>

0 commit comments

Comments
 (0)