func fix(f: (T -> U) -> T -> U) -> T -> U { return { f(fix(f))($0) } } func id(a: A) -> A { return a } func const(a: A)(_ b: B) -> A { return a } func >>> (f: T -> U, g: U -> V) -> T -> V { return { g(f($0)) } } extension Optional { static func equals(param: (Wrapped, Wrapped) -> Bool)(_ left: Wrapped?, _ right: Wrapped?) -> Bool { switch (left, right) { case let (.Some(a), .Some(b)): return param(a, b) case (.None, .None): return true default: return false } } }