We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f44a03f commit 71c2c80Copy full SHA for 71c2c80
.swift-version
@@ -0,0 +1 @@
1
+3.0
Sources/Pipes.swift
@@ -14,7 +14,17 @@
14
limitations under the License.
15
*/
16
17
-infix operator |> {associativity left precedence 100}
18
-public func |> <T,S>(lhs: T, rhs: (T)->S) -> S {
19
- return rhs(lhs)
20
-}
+precedencegroup LeftFunctionalApply {
+ associativity: left
+ higherThan: AssignmentPrecedence
+ lowerThan: TernaryPrecedence
21
+}
22
+
23
+// pipe val into monadic fn
24
+infix operator |> : LeftFunctionalApply
25
26
27
+@discardableResult
28
+public func |> <A, B> ( x: A, f: (A) throws -> B ) rethrows -> B {
29
+ return try f(x)
30
0 commit comments