Skip to content

Commit

Permalink
Pipe operator introduced
Browse files Browse the repository at this point in the history
  • Loading branch information
bigMOTOR committed Jun 19, 2022
1 parent db22606 commit a90fa09
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions Sources/Helpers/Operators/Pipe.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//
// Pipe.swift
//
//
// Created by Nikolay Fiantsev on 25.05.2022.
//

import Foundation

precedencegroup CompositionPrecedence {
associativity: left
}

infix operator |> : CompositionPrecedence

public func |> <A, B, C>(f: @escaping (A)->B, g: @escaping (B)->C) -> (A)->C {
return { a -> C in
g(f(a))
}
}

0 comments on commit a90fa09

Please sign in to comment.