Created
January 26, 2019 10:48
-
-
Save swift2931/89d3dec47afb5c312ae53b974b7ad27e to your computer and use it in GitHub Desktop.
Elf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
func dp(_ any: Any...) { | |
print(any) | |
} | |
protocol Redux: class { | |
func action(_ f: String) -> (Self) -> () | |
func effect(_ f: String) -> Self | |
func effect(_ desc: String, _ cls: () -> ()) -> Self | |
} | |
extension Redux { | |
var marker: String { | |
return " ----------------------------------" | |
} | |
func action(_ f: String = #function) -> (Self) -> () { | |
dp(f+marker) | |
return {_ in } | |
} | |
func effect(_ f: String = #function) -> Self { | |
dp(f) | |
return self | |
} | |
func effect(_ desc: String, _ cls: () -> ()) -> Self { | |
dp(desc) | |
cls() | |
return self | |
} | |
} | |
infix operator << | |
func <<<T>(_ lhs: (T) -> (), _ rhs: T) { | |
lhs(rhs) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment