Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct Functor<Type, ReturnType> {
- let method: (Type) -> ReturnType
- func run(_ value: Type) -> ReturnType {
- return method(value)
- }
- func runnable<Ignored>(_ value: Type) -> (Ignored) -> ReturnType {
- return { _ in self.method(value) }
- }
- }
- extension Functor where Type == Void {
- func run() -> ReturnType {
- return method(())
- }
- }
Add Comment
Please, Sign In to add comment