Skip to content

Commit a90fa09

Browse files
committed
Pipe operator introduced
1 parent db22606 commit a90fa09

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
//
2+
// Pipe.swift
3+
//
4+
//
5+
// Created by Nikolay Fiantsev on 25.05.2022.
6+
//
7+
8+
import Foundation
9+
10+
precedencegroup CompositionPrecedence {
11+
associativity: left
12+
}
13+
14+
infix operator |> : CompositionPrecedence
15+
16+
public func |> <A, B, C>(f: @escaping (A)->B, g: @escaping (B)->C) -> (A)->C {
17+
return { a -> C in
18+
g(f(a))
19+
}
20+
}

0 commit comments

Comments
 (0)