diff --git a/Sources/FunctionalKit/Adapter.swift b/Sources/FunctionalKit/Adapter.swift index 5861d5d..6810ab8 100644 --- a/Sources/FunctionalKit/Adapter.swift +++ b/Sources/FunctionalKit/Adapter.swift @@ -36,8 +36,8 @@ public extension Writer { public extension Result { enum iso { - public static var coproduct: Iso> { - return Iso>.init( + public static var coproduct: Iso> { + return Iso>.init( from: { switch $0 { case let .success(value): diff --git a/Sources/FunctionalKit/Array.swift b/Sources/FunctionalKit/Array.swift index 8d9b1dd..59225ce 100644 --- a/Sources/FunctionalKit/Array.swift +++ b/Sources/FunctionalKit/Array.swift @@ -104,7 +104,7 @@ public extension Array { } } - func traverse (_ transform: (ParameterType) -> Result) -> Result> { + func traverse (_ transform: (ParameterType) -> Result) -> Result,F> { return reduce(Result.pure([])) { previous, element in Result.pure(f.curry(++)) <*> previous <*> transform(element) } diff --git a/Sources/FunctionalKit/FunctorTransformers2.generated.swift b/Sources/FunctionalKit/FunctorTransformers2.generated.swift index 7e6085c..3469229 100644 --- a/Sources/FunctionalKit/FunctorTransformers2.generated.swift +++ b/Sources/FunctionalKit/FunctorTransformers2.generated.swift @@ -3,448 +3,211 @@ - - - - - - public extension Array { - - - - func mapT (_ transform: (Input) -> Output) -> Array> where ParameterType == Array { return fmap { $0.fmap(transform) } } - - - func mapT (_ transform: @escaping (Input) -> Output) -> Array> where ParameterType == Effect { return fmap { $0.map(transform) } } - - - func mapT (_ transform: @escaping (Input) -> Output) -> Array> where ParameterType == Future { return fmap { $0.map(transform) } } - - - func mapT (_ transform: (Input) -> Output) -> Array> where ParameterType == Optional { return fmap { $0.fmap(transform) } } - - - - func mapT (_ transform: @escaping (Input) -> Output) -> Array> where ParameterType == Reader { + func mapT (_ transform: @escaping (Input) -> Output) -> Array> where ParameterType == Reader { return fmap { $0.map(transform) } } - - - - func mapT (_ transform: (Input) -> Output) -> Array> where ParameterType == Result { + func mapT (_ transform: (Input) -> Output) -> Array> where ParameterType == Result { return fmap { $0.map(transform) } } - - - - func mapT (_ transform: @escaping (Input) -> Output) -> Array> where ParameterType == State { + func mapT (_ transform: @escaping (Input) -> Output) -> Array> where ParameterType == State { return fmap { $0.map(transform) } } - - - - func mapT (_ transform: (Input) -> Output) -> Array> where ParameterType == Writer { + func mapT (_ transform: (Input) -> Output) -> Array> where ParameterType == Writer { return fmap { $0.map(transform) } } } - - - - public extension Effect { - - - - func mapT (_ transform: @escaping (Input) -> Output) -> Effect> where ParameterType == Array { return map { $0.fmap(transform) } } - - - func mapT (_ transform: @escaping (Input) -> Output) -> Effect> where ParameterType == Effect { return map { $0.map(transform) } } - - - func mapT (_ transform: @escaping (Input) -> Output) -> Effect> where ParameterType == Future { return map { $0.map(transform) } } - - - func mapT (_ transform: @escaping (Input) -> Output) -> Effect> where ParameterType == Optional { return map { $0.fmap(transform) } } - - - - func mapT (_ transform: @escaping (Input) -> Output) -> Effect> where ParameterType == Reader { + func mapT (_ transform: @escaping (Input) -> Output) -> Effect> where ParameterType == Reader { return map { $0.map(transform) } } - - - - func mapT (_ transform: @escaping (Input) -> Output) -> Effect> where ParameterType == Result { + func mapT (_ transform: @escaping (Input) -> Output) -> Effect> where ParameterType == Result { return map { $0.map(transform) } } - - - - func mapT (_ transform: @escaping (Input) -> Output) -> Effect> where ParameterType == State { + func mapT (_ transform: @escaping (Input) -> Output) -> Effect> where ParameterType == State { return map { $0.map(transform) } } - - - - func mapT (_ transform: @escaping (Input) -> Output) -> Effect> where ParameterType == Writer { + func mapT (_ transform: @escaping (Input) -> Output) -> Effect> where ParameterType == Writer { return map { $0.map(transform) } } } - - - - public extension Future { - - - - func mapT (_ transform: @escaping (Input) -> Output) -> Future> where ParameterType == Array { return map { $0.fmap(transform) } } - - - func mapT (_ transform: @escaping (Input) -> Output) -> Future> where ParameterType == Effect { return map { $0.map(transform) } } - - - func mapT (_ transform: @escaping (Input) -> Output) -> Future> where ParameterType == Future { return map { $0.map(transform) } } - - - func mapT (_ transform: @escaping (Input) -> Output) -> Future> where ParameterType == Optional { return map { $0.fmap(transform) } } - - - - func mapT (_ transform: @escaping (Input) -> Output) -> Future> where ParameterType == Reader { + func mapT (_ transform: @escaping (Input) -> Output) -> Future> where ParameterType == Reader { return map { $0.map(transform) } } - - - - func mapT (_ transform: @escaping (Input) -> Output) -> Future> where ParameterType == Result { + func mapT (_ transform: @escaping (Input) -> Output) -> Future> where ParameterType == Result { return map { $0.map(transform) } } - - - - func mapT (_ transform: @escaping (Input) -> Output) -> Future> where ParameterType == State { + func mapT (_ transform: @escaping (Input) -> Output) -> Future> where ParameterType == State { return map { $0.map(transform) } } - - - - func mapT (_ transform: @escaping (Input) -> Output) -> Future> where ParameterType == Writer { + func mapT (_ transform: @escaping (Input) -> Output) -> Future> where ParameterType == Writer { return map { $0.map(transform) } } } - - - - public extension Optional { - - - - func mapT (_ transform: (Input) -> Output) -> Optional> where ParameterType == Array { return fmap { $0.fmap(transform) } } - - - func mapT (_ transform: @escaping (Input) -> Output) -> Optional> where ParameterType == Effect { return fmap { $0.map(transform) } } - - - func mapT (_ transform: @escaping (Input) -> Output) -> Optional> where ParameterType == Future { return fmap { $0.map(transform) } } - - - func mapT (_ transform: (Input) -> Output) -> Optional> where ParameterType == Optional { return fmap { $0.fmap(transform) } } - - - - func mapT (_ transform: @escaping (Input) -> Output) -> Optional> where ParameterType == Reader { + func mapT (_ transform: @escaping (Input) -> Output) -> Optional> where ParameterType == Reader { return fmap { $0.map(transform) } } - - - - func mapT (_ transform: (Input) -> Output) -> Optional> where ParameterType == Result { + func mapT (_ transform: (Input) -> Output) -> Optional> where ParameterType == Result { return fmap { $0.map(transform) } } - - - - func mapT (_ transform: @escaping (Input) -> Output) -> Optional> where ParameterType == State { + func mapT (_ transform: @escaping (Input) -> Output) -> Optional> where ParameterType == State { return fmap { $0.map(transform) } } - - - - func mapT (_ transform: (Input) -> Output) -> Optional> where ParameterType == Writer { + func mapT (_ transform: (Input) -> Output) -> Optional> where ParameterType == Writer { return fmap { $0.map(transform) } } } - - - - public extension Reader { - - - - func mapT (_ transform: @escaping (Input) -> Output) -> Reader> where ParameterType == Array { return map { $0.fmap(transform) } } - - - func mapT (_ transform: @escaping (Input) -> Output) -> Reader> where ParameterType == Effect { return map { $0.map(transform) } } - - - func mapT (_ transform: @escaping (Input) -> Output) -> Reader> where ParameterType == Future { return map { $0.map(transform) } } - - - func mapT (_ transform: @escaping (Input) -> Output) -> Reader> where ParameterType == Optional { return map { $0.fmap(transform) } } - - - - func mapT (_ transform: @escaping (Input) -> Output) -> Reader> where ParameterType == Reader { + func mapT (_ transform: @escaping (Input) -> Output) -> Reader> where ParameterType == Reader { return map { $0.map(transform) } } - - - - func mapT (_ transform: @escaping (Input) -> Output) -> Reader> where ParameterType == Result { + func mapT (_ transform: @escaping (Input) -> Output) -> Reader> where ParameterType == Result { return map { $0.map(transform) } } - - - - func mapT (_ transform: @escaping (Input) -> Output) -> Reader> where ParameterType == State { + func mapT (_ transform: @escaping (Input) -> Output) -> Reader> where ParameterType == State { return map { $0.map(transform) } } - - - - func mapT (_ transform: @escaping (Input) -> Output) -> Reader> where ParameterType == Writer { + func mapT (_ transform: @escaping (Input) -> Output) -> Reader> where ParameterType == Writer { return map { $0.map(transform) } } } - - - - public extension Result { - - - - - func mapT (_ transform: (Input) -> Output) -> Result> where ParameterType == Array { + func mapT (_ transform: (Input) -> Output) -> Result,Failure> where ParameterType == Array { return map { $0.fmap(transform) } } - - - - func mapT (_ transform: @escaping (Input) -> Output) -> Result> where ParameterType == Effect { + func mapT (_ transform: @escaping (Input) -> Output) -> Result,Failure> where ParameterType == Effect { return map { $0.map(transform) } } - - - - func mapT (_ transform: @escaping (Input) -> Output) -> Result> where ParameterType == Future { + func mapT (_ transform: @escaping (Input) -> Output) -> Result,Failure> where ParameterType == Future { return map { $0.map(transform) } } - - - - func mapT (_ transform: (Input) -> Output) -> Result> where ParameterType == Optional { + func mapT (_ transform: (Input) -> Output) -> Result,Failure> where ParameterType == Optional { return map { $0.fmap(transform) } } - - - - func mapT (_ transform: @escaping (Input) -> Output) -> Result> where ParameterType == Reader { + func mapT (_ transform: @escaping (Input) -> Output) -> Result,Failure> where ParameterType == Reader { return map { $0.map(transform) } } - - - - func mapT (_ transform: (Input) -> Output) -> Result> where ParameterType == Result { + func mapT (_ transform: (Input) -> Output) -> Result,Failure> where ParameterType == Result { return map { $0.map(transform) } } - - - - func mapT (_ transform: @escaping (Input) -> Output) -> Result> where ParameterType == State { + func mapT (_ transform: @escaping (Input) -> Output) -> Result,Failure> where ParameterType == State { return map { $0.map(transform) } } - - - - func mapT (_ transform: (Input) -> Output) -> Result> where ParameterType == Writer { + func mapT (_ transform: (Input) -> Output) -> Result,Failure> where ParameterType == Writer { return map { $0.map(transform) } } } - - - - public extension State { - - - - func mapT (_ transform: @escaping (Input) -> Output) -> State> where ParameterType == Array { return map { $0.fmap(transform) } } - - - func mapT (_ transform: @escaping (Input) -> Output) -> State> where ParameterType == Effect { return map { $0.map(transform) } } - - - func mapT (_ transform: @escaping (Input) -> Output) -> State> where ParameterType == Future { return map { $0.map(transform) } } - - - func mapT (_ transform: @escaping (Input) -> Output) -> State> where ParameterType == Optional { return map { $0.fmap(transform) } } - - - - func mapT (_ transform: @escaping (Input) -> Output) -> State> where ParameterType == Reader { + func mapT (_ transform: @escaping (Input) -> Output) -> State> where ParameterType == Reader { return map { $0.map(transform) } } - - - - func mapT (_ transform: @escaping (Input) -> Output) -> State> where ParameterType == Result { + func mapT (_ transform: @escaping (Input) -> Output) -> State> where ParameterType == Result { return map { $0.map(transform) } } - - - - func mapT (_ transform: @escaping (Input) -> Output) -> State> where ParameterType == State { + func mapT (_ transform: @escaping (Input) -> Output) -> State> where ParameterType == State { return map { $0.map(transform) } } - - - - func mapT (_ transform: @escaping (Input) -> Output) -> State> where ParameterType == Writer { + func mapT (_ transform: @escaping (Input) -> Output) -> State> where ParameterType == Writer { return map { $0.map(transform) } } } - - - - public extension Writer { - - - - func mapT (_ transform: (Input) -> Output) -> Writer> where ParameterType == Array { return map { $0.fmap(transform) } } - - - func mapT (_ transform: @escaping (Input) -> Output) -> Writer> where ParameterType == Effect { return map { $0.map(transform) } } - - - func mapT (_ transform: @escaping (Input) -> Output) -> Writer> where ParameterType == Future { return map { $0.map(transform) } } - - - func mapT (_ transform: (Input) -> Output) -> Writer> where ParameterType == Optional { return map { $0.fmap(transform) } } - - - - func mapT (_ transform: @escaping (Input) -> Output) -> Writer> where ParameterType == Reader { + func mapT (_ transform: @escaping (Input) -> Output) -> Writer> where ParameterType == Reader { return map { $0.map(transform) } } - - - - func mapT (_ transform: (Input) -> Output) -> Writer> where ParameterType == Result { + func mapT (_ transform: (Input) -> Output) -> Writer> where ParameterType == Result { return map { $0.map(transform) } } - - - - func mapT (_ transform: @escaping (Input) -> Output) -> Writer> where ParameterType == State { + func mapT (_ transform: @escaping (Input) -> Output) -> Writer> where ParameterType == State { return map { $0.map(transform) } } - - - - func mapT (_ transform: (Input) -> Output) -> Writer> where ParameterType == Writer { + func mapT (_ transform: (Input) -> Output) -> Writer> where ParameterType == Writer { return map { $0.map(transform) } } } - - - diff --git a/Sources/FunctionalKit/FunctorTransformers3.generated.swift b/Sources/FunctionalKit/FunctorTransformers3.generated.swift index 89e4447..607a838 100644 --- a/Sources/FunctionalKit/FunctorTransformers3.generated.swift +++ b/Sources/FunctionalKit/FunctorTransformers3.generated.swift @@ -3,3648 +3,1555 @@ - - - - - - public extension Array { - - - - - func mapTT (_ transform: (Input) -> Output) -> Array>> where ParameterType == Array> { return fmap { $0.fmap { $0.fmap(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Array>> where ParameterType == Array> { return fmap { $0.fmap { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Array>> where ParameterType == Array> { return fmap { $0.fmap { $0.map(transform) } } } - - - - func mapTT (_ transform: (Input) -> Output) -> Array>> where ParameterType == Array> { return fmap { $0.fmap { $0.fmap(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Array>> where ParameterType == Array> { return fmap { $0.fmap { $0.map(transform) } } } - - - - - func mapTT (_ transform: (Input) -> Output) -> Array>> where ParameterType == Array> { + func mapTT (_ transform: (Input) -> Output) -> Array>> where ParameterType == Array> { return fmap { $0.fmap { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Array>> where ParameterType == Array> { return fmap { $0.fmap { $0.map(transform) } } } - - - - func mapTT (_ transform: (Input) -> Output) -> Array>> where ParameterType == Array> { return fmap { $0.fmap { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Array>> where ParameterType == Effect> { return fmap { $0.map { $0.fmap(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Array>> where ParameterType == Effect> { return fmap { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Array>> where ParameterType == Effect> { return fmap { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Array>> where ParameterType == Effect> { return fmap { $0.map { $0.fmap(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Array>> where ParameterType == Effect> { return fmap { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Array>> where ParameterType == Effect> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Array>> where ParameterType == Effect> { return fmap { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Array>> where ParameterType == Effect> { return fmap { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Array>> where ParameterType == Effect> { return fmap { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Array>> where ParameterType == Future> { return fmap { $0.map { $0.fmap(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Array>> where ParameterType == Future> { return fmap { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Array>> where ParameterType == Future> { return fmap { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Array>> where ParameterType == Future> { return fmap { $0.map { $0.fmap(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Array>> where ParameterType == Future> { return fmap { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Array>> where ParameterType == Future> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Array>> where ParameterType == Future> { return fmap { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Array>> where ParameterType == Future> { return fmap { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Array>> where ParameterType == Future> { return fmap { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: (Input) -> Output) -> Array>> where ParameterType == Optional> { return fmap { $0.fmap { $0.fmap(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Array>> where ParameterType == Optional> { return fmap { $0.fmap { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Array>> where ParameterType == Optional> { return fmap { $0.fmap { $0.map(transform) } } } - - - - func mapTT (_ transform: (Input) -> Output) -> Array>> where ParameterType == Optional> { return fmap { $0.fmap { $0.fmap(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Array>> where ParameterType == Optional> { return fmap { $0.fmap { $0.map(transform) } } } - - - - - func mapTT (_ transform: (Input) -> Output) -> Array>> where ParameterType == Optional> { + func mapTT (_ transform: (Input) -> Output) -> Array>> where ParameterType == Optional> { return fmap { $0.fmap { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Array>> where ParameterType == Optional> { return fmap { $0.fmap { $0.map(transform) } } } - - - - func mapTT (_ transform: (Input) -> Output) -> Array>> where ParameterType == Optional> { return fmap { $0.fmap { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Array>> where ParameterType == Reader> { return fmap { $0.map { $0.fmap(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Array>> where ParameterType == Reader> { return fmap { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Array>> where ParameterType == Reader> { return fmap { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Array>> where ParameterType == Reader> { return fmap { $0.map { $0.fmap(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Array>> where ParameterType == Reader> { return fmap { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Array>> where ParameterType == Reader> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Array>> where ParameterType == Reader> { return fmap { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Array>> where ParameterType == Reader> { return fmap { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Array>> where ParameterType == Reader> { return fmap { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: (Input) -> Output) -> Array>> where ParameterType == Result> { + func mapTT (_ transform: (Input) -> Output) -> Array,Secondary2>> where ParameterType == Result,Secondary2> { return fmap { $0.map { $0.fmap(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Array>> where ParameterType == Result> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Array,Secondary2>> where ParameterType == Result,Secondary2> { return fmap { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Array>> where ParameterType == Result> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Array,Secondary2>> where ParameterType == Result,Secondary2> { return fmap { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: (Input) -> Output) -> Array>> where ParameterType == Result> { + func mapTT (_ transform: (Input) -> Output) -> Array,Secondary2>> where ParameterType == Result,Secondary2> { return fmap { $0.map { $0.fmap(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Array>> where ParameterType == Result> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Array,Secondary2>> where ParameterType == Result,Secondary2> { return fmap { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: (Input) -> Output) -> Array>> where ParameterType == Result> { + func mapTT (_ transform: (Input) -> Output) -> Array,Secondary2>> where ParameterType == Result,Secondary2> { return fmap { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Array>> where ParameterType == Result> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Array,Secondary2>> where ParameterType == Result,Secondary2> { return fmap { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: (Input) -> Output) -> Array>> where ParameterType == Result> { + func mapTT (_ transform: (Input) -> Output) -> Array,Secondary2>> where ParameterType == Result,Secondary2> { return fmap { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Array>> where ParameterType == State> { return fmap { $0.map { $0.fmap(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Array>> where ParameterType == State> { return fmap { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Array>> where ParameterType == State> { return fmap { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Array>> where ParameterType == State> { return fmap { $0.map { $0.fmap(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Array>> where ParameterType == State> { return fmap { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Array>> where ParameterType == State> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Array>> where ParameterType == State> { return fmap { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Array>> where ParameterType == State> { return fmap { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Array>> where ParameterType == State> { return fmap { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: (Input) -> Output) -> Array>> where ParameterType == Writer> { return fmap { $0.map { $0.fmap(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Array>> where ParameterType == Writer> { return fmap { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Array>> where ParameterType == Writer> { return fmap { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: (Input) -> Output) -> Array>> where ParameterType == Writer> { return fmap { $0.map { $0.fmap(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Array>> where ParameterType == Writer> { return fmap { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: (Input) -> Output) -> Array>> where ParameterType == Writer> { + func mapTT (_ transform: (Input) -> Output) -> Array>> where ParameterType == Writer> { return fmap { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Array>> where ParameterType == Writer> { return fmap { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: (Input) -> Output) -> Array>> where ParameterType == Writer> { return fmap { $0.map { $0.map(transform) } } } } - - - - public extension Effect { - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Effect>> where ParameterType == Array> { return map { $0.fmap { $0.fmap(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Effect>> where ParameterType == Array> { return map { $0.fmap { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Effect>> where ParameterType == Array> { return map { $0.fmap { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Effect>> where ParameterType == Array> { return map { $0.fmap { $0.fmap(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Effect>> where ParameterType == Array> { return map { $0.fmap { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Effect>> where ParameterType == Array> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Effect>> where ParameterType == Array> { return map { $0.fmap { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Effect>> where ParameterType == Array> { return map { $0.fmap { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Effect>> where ParameterType == Array> { return map { $0.fmap { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Effect>> where ParameterType == Effect> { return map { $0.map { $0.fmap(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Effect>> where ParameterType == Effect> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Effect>> where ParameterType == Effect> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Effect>> where ParameterType == Effect> { return map { $0.map { $0.fmap(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Effect>> where ParameterType == Effect> { return map { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Effect>> where ParameterType == Effect> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Effect>> where ParameterType == Effect> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Effect>> where ParameterType == Effect> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Effect>> where ParameterType == Effect> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Effect>> where ParameterType == Future> { return map { $0.map { $0.fmap(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Effect>> where ParameterType == Future> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Effect>> where ParameterType == Future> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Effect>> where ParameterType == Future> { return map { $0.map { $0.fmap(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Effect>> where ParameterType == Future> { return map { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Effect>> where ParameterType == Future> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Effect>> where ParameterType == Future> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Effect>> where ParameterType == Future> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Effect>> where ParameterType == Future> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Effect>> where ParameterType == Optional> { return map { $0.fmap { $0.fmap(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Effect>> where ParameterType == Optional> { return map { $0.fmap { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Effect>> where ParameterType == Optional> { return map { $0.fmap { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Effect>> where ParameterType == Optional> { return map { $0.fmap { $0.fmap(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Effect>> where ParameterType == Optional> { return map { $0.fmap { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Effect>> where ParameterType == Optional> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Effect>> where ParameterType == Optional> { return map { $0.fmap { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Effect>> where ParameterType == Optional> { return map { $0.fmap { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Effect>> where ParameterType == Optional> { return map { $0.fmap { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Effect>> where ParameterType == Reader> { return map { $0.map { $0.fmap(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Effect>> where ParameterType == Reader> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Effect>> where ParameterType == Reader> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Effect>> where ParameterType == Reader> { return map { $0.map { $0.fmap(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Effect>> where ParameterType == Reader> { return map { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Effect>> where ParameterType == Reader> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Effect>> where ParameterType == Reader> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Effect>> where ParameterType == Reader> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Effect>> where ParameterType == Reader> { return map { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Effect>> where ParameterType == Result> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Effect,Secondary2>> where ParameterType == Result,Secondary2> { return map { $0.map { $0.fmap(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Effect>> where ParameterType == Result> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Effect,Secondary2>> where ParameterType == Result,Secondary2> { return map { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Effect>> where ParameterType == Result> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Effect,Secondary2>> where ParameterType == Result,Secondary2> { return map { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Effect>> where ParameterType == Result> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Effect,Secondary2>> where ParameterType == Result,Secondary2> { return map { $0.map { $0.fmap(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Effect>> where ParameterType == Result> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Effect,Secondary2>> where ParameterType == Result,Secondary2> { return map { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Effect>> where ParameterType == Result> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Effect,Secondary2>> where ParameterType == Result,Secondary2> { return map { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Effect>> where ParameterType == Result> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Effect,Secondary2>> where ParameterType == Result,Secondary2> { return map { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Effect>> where ParameterType == Result> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Effect,Secondary2>> where ParameterType == Result,Secondary2> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Effect>> where ParameterType == State> { return map { $0.map { $0.fmap(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Effect>> where ParameterType == State> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Effect>> where ParameterType == State> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Effect>> where ParameterType == State> { return map { $0.map { $0.fmap(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Effect>> where ParameterType == State> { return map { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Effect>> where ParameterType == State> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Effect>> where ParameterType == State> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Effect>> where ParameterType == State> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Effect>> where ParameterType == State> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Effect>> where ParameterType == Writer> { return map { $0.map { $0.fmap(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Effect>> where ParameterType == Writer> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Effect>> where ParameterType == Writer> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Effect>> where ParameterType == Writer> { return map { $0.map { $0.fmap(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Effect>> where ParameterType == Writer> { return map { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Effect>> where ParameterType == Writer> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Effect>> where ParameterType == Writer> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Effect>> where ParameterType == Writer> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Effect>> where ParameterType == Writer> { return map { $0.map { $0.map(transform) } } } } - - - - public extension Future { - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Future>> where ParameterType == Array> { return map { $0.fmap { $0.fmap(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Future>> where ParameterType == Array> { return map { $0.fmap { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Future>> where ParameterType == Array> { return map { $0.fmap { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Future>> where ParameterType == Array> { return map { $0.fmap { $0.fmap(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Future>> where ParameterType == Array> { return map { $0.fmap { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Future>> where ParameterType == Array> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Future>> where ParameterType == Array> { return map { $0.fmap { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Future>> where ParameterType == Array> { return map { $0.fmap { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Future>> where ParameterType == Array> { return map { $0.fmap { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Future>> where ParameterType == Effect> { return map { $0.map { $0.fmap(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Future>> where ParameterType == Effect> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Future>> where ParameterType == Effect> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Future>> where ParameterType == Effect> { return map { $0.map { $0.fmap(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Future>> where ParameterType == Effect> { return map { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Future>> where ParameterType == Effect> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Future>> where ParameterType == Effect> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Future>> where ParameterType == Effect> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Future>> where ParameterType == Effect> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Future>> where ParameterType == Future> { return map { $0.map { $0.fmap(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Future>> where ParameterType == Future> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Future>> where ParameterType == Future> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Future>> where ParameterType == Future> { return map { $0.map { $0.fmap(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Future>> where ParameterType == Future> { return map { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Future>> where ParameterType == Future> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Future>> where ParameterType == Future> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Future>> where ParameterType == Future> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Future>> where ParameterType == Future> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Future>> where ParameterType == Optional> { return map { $0.fmap { $0.fmap(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Future>> where ParameterType == Optional> { return map { $0.fmap { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Future>> where ParameterType == Optional> { return map { $0.fmap { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Future>> where ParameterType == Optional> { return map { $0.fmap { $0.fmap(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Future>> where ParameterType == Optional> { return map { $0.fmap { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Future>> where ParameterType == Optional> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Future>> where ParameterType == Optional> { return map { $0.fmap { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Future>> where ParameterType == Optional> { return map { $0.fmap { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Future>> where ParameterType == Optional> { return map { $0.fmap { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Future>> where ParameterType == Reader> { return map { $0.map { $0.fmap(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Future>> where ParameterType == Reader> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Future>> where ParameterType == Reader> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Future>> where ParameterType == Reader> { return map { $0.map { $0.fmap(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Future>> where ParameterType == Reader> { return map { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Future>> where ParameterType == Reader> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Future>> where ParameterType == Reader> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Future>> where ParameterType == Reader> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Future>> where ParameterType == Reader> { return map { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Future>> where ParameterType == Result> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Future,Secondary2>> where ParameterType == Result,Secondary2> { return map { $0.map { $0.fmap(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Future>> where ParameterType == Result> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Future,Secondary2>> where ParameterType == Result,Secondary2> { return map { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Future>> where ParameterType == Result> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Future,Secondary2>> where ParameterType == Result,Secondary2> { return map { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Future>> where ParameterType == Result> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Future,Secondary2>> where ParameterType == Result,Secondary2> { return map { $0.map { $0.fmap(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Future>> where ParameterType == Result> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Future,Secondary2>> where ParameterType == Result,Secondary2> { return map { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Future>> where ParameterType == Result> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Future,Secondary2>> where ParameterType == Result,Secondary2> { return map { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Future>> where ParameterType == Result> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Future,Secondary2>> where ParameterType == Result,Secondary2> { return map { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Future>> where ParameterType == Result> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Future,Secondary2>> where ParameterType == Result,Secondary2> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Future>> where ParameterType == State> { return map { $0.map { $0.fmap(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Future>> where ParameterType == State> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Future>> where ParameterType == State> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Future>> where ParameterType == State> { return map { $0.map { $0.fmap(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Future>> where ParameterType == State> { return map { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Future>> where ParameterType == State> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Future>> where ParameterType == State> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Future>> where ParameterType == State> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Future>> where ParameterType == State> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Future>> where ParameterType == Writer> { return map { $0.map { $0.fmap(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Future>> where ParameterType == Writer> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Future>> where ParameterType == Writer> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Future>> where ParameterType == Writer> { return map { $0.map { $0.fmap(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Future>> where ParameterType == Writer> { return map { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Future>> where ParameterType == Writer> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Future>> where ParameterType == Writer> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Future>> where ParameterType == Writer> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Future>> where ParameterType == Writer> { return map { $0.map { $0.map(transform) } } } } - - - - public extension Optional { - - - - - func mapTT (_ transform: (Input) -> Output) -> Optional>> where ParameterType == Array> { return fmap { $0.fmap { $0.fmap(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Optional>> where ParameterType == Array> { return fmap { $0.fmap { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Optional>> where ParameterType == Array> { return fmap { $0.fmap { $0.map(transform) } } } - - - - func mapTT (_ transform: (Input) -> Output) -> Optional>> where ParameterType == Array> { return fmap { $0.fmap { $0.fmap(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Optional>> where ParameterType == Array> { return fmap { $0.fmap { $0.map(transform) } } } - - - - - func mapTT (_ transform: (Input) -> Output) -> Optional>> where ParameterType == Array> { + func mapTT (_ transform: (Input) -> Output) -> Optional>> where ParameterType == Array> { return fmap { $0.fmap { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Optional>> where ParameterType == Array> { return fmap { $0.fmap { $0.map(transform) } } } - - - - func mapTT (_ transform: (Input) -> Output) -> Optional>> where ParameterType == Array> { return fmap { $0.fmap { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Optional>> where ParameterType == Effect> { return fmap { $0.map { $0.fmap(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Optional>> where ParameterType == Effect> { return fmap { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Optional>> where ParameterType == Effect> { return fmap { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Optional>> where ParameterType == Effect> { return fmap { $0.map { $0.fmap(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Optional>> where ParameterType == Effect> { return fmap { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Optional>> where ParameterType == Effect> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Optional>> where ParameterType == Effect> { return fmap { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Optional>> where ParameterType == Effect> { return fmap { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Optional>> where ParameterType == Effect> { return fmap { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Optional>> where ParameterType == Future> { return fmap { $0.map { $0.fmap(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Optional>> where ParameterType == Future> { return fmap { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Optional>> where ParameterType == Future> { return fmap { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Optional>> where ParameterType == Future> { return fmap { $0.map { $0.fmap(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Optional>> where ParameterType == Future> { return fmap { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Optional>> where ParameterType == Future> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Optional>> where ParameterType == Future> { return fmap { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Optional>> where ParameterType == Future> { return fmap { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Optional>> where ParameterType == Future> { return fmap { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: (Input) -> Output) -> Optional>> where ParameterType == Optional> { return fmap { $0.fmap { $0.fmap(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Optional>> where ParameterType == Optional> { return fmap { $0.fmap { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Optional>> where ParameterType == Optional> { return fmap { $0.fmap { $0.map(transform) } } } - - - - func mapTT (_ transform: (Input) -> Output) -> Optional>> where ParameterType == Optional> { return fmap { $0.fmap { $0.fmap(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Optional>> where ParameterType == Optional> { return fmap { $0.fmap { $0.map(transform) } } } - - - - - func mapTT (_ transform: (Input) -> Output) -> Optional>> where ParameterType == Optional> { + func mapTT (_ transform: (Input) -> Output) -> Optional>> where ParameterType == Optional> { return fmap { $0.fmap { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Optional>> where ParameterType == Optional> { return fmap { $0.fmap { $0.map(transform) } } } - - - - func mapTT (_ transform: (Input) -> Output) -> Optional>> where ParameterType == Optional> { return fmap { $0.fmap { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Optional>> where ParameterType == Reader> { return fmap { $0.map { $0.fmap(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Optional>> where ParameterType == Reader> { return fmap { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Optional>> where ParameterType == Reader> { return fmap { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Optional>> where ParameterType == Reader> { return fmap { $0.map { $0.fmap(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Optional>> where ParameterType == Reader> { return fmap { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Optional>> where ParameterType == Reader> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Optional>> where ParameterType == Reader> { return fmap { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Optional>> where ParameterType == Reader> { return fmap { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Optional>> where ParameterType == Reader> { return fmap { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: (Input) -> Output) -> Optional>> where ParameterType == Result> { + func mapTT (_ transform: (Input) -> Output) -> Optional,Secondary2>> where ParameterType == Result,Secondary2> { return fmap { $0.map { $0.fmap(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Optional>> where ParameterType == Result> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Optional,Secondary2>> where ParameterType == Result,Secondary2> { return fmap { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Optional>> where ParameterType == Result> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Optional,Secondary2>> where ParameterType == Result,Secondary2> { return fmap { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: (Input) -> Output) -> Optional>> where ParameterType == Result> { + func mapTT (_ transform: (Input) -> Output) -> Optional,Secondary2>> where ParameterType == Result,Secondary2> { return fmap { $0.map { $0.fmap(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Optional>> where ParameterType == Result> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Optional,Secondary2>> where ParameterType == Result,Secondary2> { return fmap { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: (Input) -> Output) -> Optional>> where ParameterType == Result> { + func mapTT (_ transform: (Input) -> Output) -> Optional,Secondary2>> where ParameterType == Result,Secondary2> { return fmap { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Optional>> where ParameterType == Result> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Optional,Secondary2>> where ParameterType == Result,Secondary2> { return fmap { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: (Input) -> Output) -> Optional>> where ParameterType == Result> { + func mapTT (_ transform: (Input) -> Output) -> Optional,Secondary2>> where ParameterType == Result,Secondary2> { return fmap { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Optional>> where ParameterType == State> { return fmap { $0.map { $0.fmap(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Optional>> where ParameterType == State> { return fmap { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Optional>> where ParameterType == State> { return fmap { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Optional>> where ParameterType == State> { return fmap { $0.map { $0.fmap(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Optional>> where ParameterType == State> { return fmap { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Optional>> where ParameterType == State> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Optional>> where ParameterType == State> { return fmap { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Optional>> where ParameterType == State> { return fmap { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Optional>> where ParameterType == State> { return fmap { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: (Input) -> Output) -> Optional>> where ParameterType == Writer> { return fmap { $0.map { $0.fmap(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Optional>> where ParameterType == Writer> { return fmap { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Optional>> where ParameterType == Writer> { return fmap { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: (Input) -> Output) -> Optional>> where ParameterType == Writer> { return fmap { $0.map { $0.fmap(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Optional>> where ParameterType == Writer> { return fmap { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: (Input) -> Output) -> Optional>> where ParameterType == Writer> { + func mapTT (_ transform: (Input) -> Output) -> Optional>> where ParameterType == Writer> { return fmap { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Optional>> where ParameterType == Writer> { return fmap { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: (Input) -> Output) -> Optional>> where ParameterType == Writer> { return fmap { $0.map { $0.map(transform) } } } } - - - - public extension Reader { - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Reader>> where ParameterType == Array> { return map { $0.fmap { $0.fmap(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Reader>> where ParameterType == Array> { return map { $0.fmap { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Reader>> where ParameterType == Array> { return map { $0.fmap { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Reader>> where ParameterType == Array> { return map { $0.fmap { $0.fmap(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Reader>> where ParameterType == Array> { return map { $0.fmap { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Reader>> where ParameterType == Array> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Reader>> where ParameterType == Array> { return map { $0.fmap { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Reader>> where ParameterType == Array> { return map { $0.fmap { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Reader>> where ParameterType == Array> { return map { $0.fmap { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Reader>> where ParameterType == Effect> { return map { $0.map { $0.fmap(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Reader>> where ParameterType == Effect> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Reader>> where ParameterType == Effect> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Reader>> where ParameterType == Effect> { return map { $0.map { $0.fmap(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Reader>> where ParameterType == Effect> { return map { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Reader>> where ParameterType == Effect> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Reader>> where ParameterType == Effect> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Reader>> where ParameterType == Effect> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Reader>> where ParameterType == Effect> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Reader>> where ParameterType == Future> { return map { $0.map { $0.fmap(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Reader>> where ParameterType == Future> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Reader>> where ParameterType == Future> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Reader>> where ParameterType == Future> { return map { $0.map { $0.fmap(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Reader>> where ParameterType == Future> { return map { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Reader>> where ParameterType == Future> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Reader>> where ParameterType == Future> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Reader>> where ParameterType == Future> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Reader>> where ParameterType == Future> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Reader>> where ParameterType == Optional> { return map { $0.fmap { $0.fmap(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Reader>> where ParameterType == Optional> { return map { $0.fmap { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Reader>> where ParameterType == Optional> { return map { $0.fmap { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Reader>> where ParameterType == Optional> { return map { $0.fmap { $0.fmap(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Reader>> where ParameterType == Optional> { return map { $0.fmap { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Reader>> where ParameterType == Optional> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Reader>> where ParameterType == Optional> { return map { $0.fmap { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Reader>> where ParameterType == Optional> { return map { $0.fmap { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Reader>> where ParameterType == Optional> { return map { $0.fmap { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Reader>> where ParameterType == Reader> { return map { $0.map { $0.fmap(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Reader>> where ParameterType == Reader> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Reader>> where ParameterType == Reader> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Reader>> where ParameterType == Reader> { return map { $0.map { $0.fmap(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Reader>> where ParameterType == Reader> { return map { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Reader>> where ParameterType == Reader> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Reader>> where ParameterType == Reader> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Reader>> where ParameterType == Reader> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Reader>> where ParameterType == Reader> { return map { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Reader>> where ParameterType == Result> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Reader,Secondary2>> where ParameterType == Result,Secondary2> { return map { $0.map { $0.fmap(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Reader>> where ParameterType == Result> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Reader,Secondary2>> where ParameterType == Result,Secondary2> { return map { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Reader>> where ParameterType == Result> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Reader,Secondary2>> where ParameterType == Result,Secondary2> { return map { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Reader>> where ParameterType == Result> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Reader,Secondary2>> where ParameterType == Result,Secondary2> { return map { $0.map { $0.fmap(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Reader>> where ParameterType == Result> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Reader,Secondary2>> where ParameterType == Result,Secondary2> { return map { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Reader>> where ParameterType == Result> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Reader,Secondary2>> where ParameterType == Result,Secondary2> { return map { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Reader>> where ParameterType == Result> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Reader,Secondary2>> where ParameterType == Result,Secondary2> { return map { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Reader>> where ParameterType == Result> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Reader,Secondary2>> where ParameterType == Result,Secondary2> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Reader>> where ParameterType == State> { return map { $0.map { $0.fmap(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Reader>> where ParameterType == State> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Reader>> where ParameterType == State> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Reader>> where ParameterType == State> { return map { $0.map { $0.fmap(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Reader>> where ParameterType == State> { return map { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Reader>> where ParameterType == State> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Reader>> where ParameterType == State> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Reader>> where ParameterType == State> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Reader>> where ParameterType == State> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Reader>> where ParameterType == Writer> { return map { $0.map { $0.fmap(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Reader>> where ParameterType == Writer> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Reader>> where ParameterType == Writer> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Reader>> where ParameterType == Writer> { return map { $0.map { $0.fmap(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Reader>> where ParameterType == Writer> { return map { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Reader>> where ParameterType == Writer> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Reader>> where ParameterType == Writer> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Reader>> where ParameterType == Writer> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Reader>> where ParameterType == Writer> { return map { $0.map { $0.map(transform) } } } } - - - - public extension Result { - - - - - - func mapTT (_ transform: (Input) -> Output) -> Result>> where ParameterType == Array> { + func mapTT (_ transform: (Input) -> Output) -> Result>,Failure> where ParameterType == Array> { return map { $0.fmap { $0.fmap(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Result>> where ParameterType == Array> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Result>,Failure> where ParameterType == Array> { return map { $0.fmap { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Result>> where ParameterType == Array> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Result>,Failure> where ParameterType == Array> { return map { $0.fmap { $0.map(transform) } } } - - - - - func mapTT (_ transform: (Input) -> Output) -> Result>> where ParameterType == Array> { + func mapTT (_ transform: (Input) -> Output) -> Result>,Failure> where ParameterType == Array> { return map { $0.fmap { $0.fmap(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Result>> where ParameterType == Array> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Result>,Failure> where ParameterType == Array> { return map { $0.fmap { $0.map(transform) } } } - - - - - func mapTT (_ transform: (Input) -> Output) -> Result>> where ParameterType == Array> { + func mapTT (_ transform: (Input) -> Output) -> Result>,Failure> where ParameterType == Array> { return map { $0.fmap { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Result>> where ParameterType == Array> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Result>,Failure> where ParameterType == Array> { return map { $0.fmap { $0.map(transform) } } } - - - - - func mapTT (_ transform: (Input) -> Output) -> Result>> where ParameterType == Array> { + func mapTT (_ transform: (Input) -> Output) -> Result>,Failure> where ParameterType == Array> { return map { $0.fmap { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Result>> where ParameterType == Effect> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Result>,Failure> where ParameterType == Effect> { return map { $0.map { $0.fmap(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Result>> where ParameterType == Effect> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Result>,Failure> where ParameterType == Effect> { return map { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Result>> where ParameterType == Effect> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Result>,Failure> where ParameterType == Effect> { return map { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Result>> where ParameterType == Effect> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Result>,Failure> where ParameterType == Effect> { return map { $0.map { $0.fmap(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Result>> where ParameterType == Effect> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Result>,Failure> where ParameterType == Effect> { return map { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Result>> where ParameterType == Effect> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Result>,Failure> where ParameterType == Effect> { return map { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Result>> where ParameterType == Effect> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Result>,Failure> where ParameterType == Effect> { return map { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Result>> where ParameterType == Effect> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Result>,Failure> where ParameterType == Effect> { return map { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Result>> where ParameterType == Future> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Result>,Failure> where ParameterType == Future> { return map { $0.map { $0.fmap(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Result>> where ParameterType == Future> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Result>,Failure> where ParameterType == Future> { return map { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Result>> where ParameterType == Future> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Result>,Failure> where ParameterType == Future> { return map { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Result>> where ParameterType == Future> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Result>,Failure> where ParameterType == Future> { return map { $0.map { $0.fmap(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Result>> where ParameterType == Future> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Result>,Failure> where ParameterType == Future> { return map { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Result>> where ParameterType == Future> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Result>,Failure> where ParameterType == Future> { return map { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Result>> where ParameterType == Future> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Result>,Failure> where ParameterType == Future> { return map { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Result>> where ParameterType == Future> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Result>,Failure> where ParameterType == Future> { return map { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: (Input) -> Output) -> Result>> where ParameterType == Optional> { + func mapTT (_ transform: (Input) -> Output) -> Result>,Failure> where ParameterType == Optional> { return map { $0.fmap { $0.fmap(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Result>> where ParameterType == Optional> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Result>,Failure> where ParameterType == Optional> { return map { $0.fmap { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Result>> where ParameterType == Optional> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Result>,Failure> where ParameterType == Optional> { return map { $0.fmap { $0.map(transform) } } } - - - - - func mapTT (_ transform: (Input) -> Output) -> Result>> where ParameterType == Optional> { + func mapTT (_ transform: (Input) -> Output) -> Result>,Failure> where ParameterType == Optional> { return map { $0.fmap { $0.fmap(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Result>> where ParameterType == Optional> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Result>,Failure> where ParameterType == Optional> { return map { $0.fmap { $0.map(transform) } } } - - - - - func mapTT (_ transform: (Input) -> Output) -> Result>> where ParameterType == Optional> { + func mapTT (_ transform: (Input) -> Output) -> Result>,Failure> where ParameterType == Optional> { return map { $0.fmap { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Result>> where ParameterType == Optional> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Result>,Failure> where ParameterType == Optional> { return map { $0.fmap { $0.map(transform) } } } - - - - - func mapTT (_ transform: (Input) -> Output) -> Result>> where ParameterType == Optional> { + func mapTT (_ transform: (Input) -> Output) -> Result>,Failure> where ParameterType == Optional> { return map { $0.fmap { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Result>> where ParameterType == Reader> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Result>,Failure> where ParameterType == Reader> { return map { $0.map { $0.fmap(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Result>> where ParameterType == Reader> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Result>,Failure> where ParameterType == Reader> { return map { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Result>> where ParameterType == Reader> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Result>,Failure> where ParameterType == Reader> { return map { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Result>> where ParameterType == Reader> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Result>,Failure> where ParameterType == Reader> { return map { $0.map { $0.fmap(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Result>> where ParameterType == Reader> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Result>,Failure> where ParameterType == Reader> { return map { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Result>> where ParameterType == Reader> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Result>,Failure> where ParameterType == Reader> { return map { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Result>> where ParameterType == Reader> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Result>,Failure> where ParameterType == Reader> { return map { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Result>> where ParameterType == Reader> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Result>,Failure> where ParameterType == Reader> { return map { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: (Input) -> Output) -> Result>> where ParameterType == Result> { + func mapTT (_ transform: (Input) -> Output) -> Result,Secondary2>,Failure> where ParameterType == Result,Secondary2> { return map { $0.map { $0.fmap(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Result>> where ParameterType == Result> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Result,Secondary2>,Failure> where ParameterType == Result,Secondary2> { return map { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Result>> where ParameterType == Result> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Result,Secondary2>,Failure> where ParameterType == Result,Secondary2> { return map { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: (Input) -> Output) -> Result>> where ParameterType == Result> { + func mapTT (_ transform: (Input) -> Output) -> Result,Secondary2>,Failure> where ParameterType == Result,Secondary2> { return map { $0.map { $0.fmap(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Result>> where ParameterType == Result> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Result,Secondary2>,Failure> where ParameterType == Result,Secondary2> { return map { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: (Input) -> Output) -> Result>> where ParameterType == Result> { + func mapTT (_ transform: (Input) -> Output) -> Result,Secondary2>,Failure> where ParameterType == Result,Secondary2> { return map { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Result>> where ParameterType == Result> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Result,Secondary2>,Failure> where ParameterType == Result,Secondary2> { return map { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: (Input) -> Output) -> Result>> where ParameterType == Result> { + func mapTT (_ transform: (Input) -> Output) -> Result,Secondary2>,Failure> where ParameterType == Result,Secondary2> { return map { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Result>> where ParameterType == State> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Result>,Failure> where ParameterType == State> { return map { $0.map { $0.fmap(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Result>> where ParameterType == State> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Result>,Failure> where ParameterType == State> { return map { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Result>> where ParameterType == State> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Result>,Failure> where ParameterType == State> { return map { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Result>> where ParameterType == State> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Result>,Failure> where ParameterType == State> { return map { $0.map { $0.fmap(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Result>> where ParameterType == State> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Result>,Failure> where ParameterType == State> { return map { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Result>> where ParameterType == State> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Result>,Failure> where ParameterType == State> { return map { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Result>> where ParameterType == State> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Result>,Failure> where ParameterType == State> { return map { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Result>> where ParameterType == State> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Result>,Failure> where ParameterType == State> { return map { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: (Input) -> Output) -> Result>> where ParameterType == Writer> { + func mapTT (_ transform: (Input) -> Output) -> Result>,Failure> where ParameterType == Writer> { return map { $0.map { $0.fmap(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Result>> where ParameterType == Writer> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Result>,Failure> where ParameterType == Writer> { return map { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Result>> where ParameterType == Writer> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Result>,Failure> where ParameterType == Writer> { return map { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: (Input) -> Output) -> Result>> where ParameterType == Writer> { + func mapTT (_ transform: (Input) -> Output) -> Result>,Failure> where ParameterType == Writer> { return map { $0.map { $0.fmap(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Result>> where ParameterType == Writer> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Result>,Failure> where ParameterType == Writer> { return map { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: (Input) -> Output) -> Result>> where ParameterType == Writer> { + func mapTT (_ transform: (Input) -> Output) -> Result>,Failure> where ParameterType == Writer> { return map { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Result>> where ParameterType == Writer> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Result>,Failure> where ParameterType == Writer> { return map { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: (Input) -> Output) -> Result>> where ParameterType == Writer> { + func mapTT (_ transform: (Input) -> Output) -> Result>,Failure> where ParameterType == Writer> { return map { $0.map { $0.map(transform) } } } } - - - - public extension State { - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> State>> where ParameterType == Array> { return map { $0.fmap { $0.fmap(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> State>> where ParameterType == Array> { - return map { $0.fmap { $0.map(transform) } } - } - - - - + return map { $0.fmap { $0.map(transform) } } + } func mapTT (_ transform: @escaping (Input) -> Output) -> State>> where ParameterType == Array> { return map { $0.fmap { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> State>> where ParameterType == Array> { return map { $0.fmap { $0.fmap(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> State>> where ParameterType == Array> { return map { $0.fmap { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> State>> where ParameterType == Array> { + func mapTT (_ transform: @escaping (Input) -> Output) -> State>> where ParameterType == Array> { return map { $0.fmap { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> State>> where ParameterType == Array> { return map { $0.fmap { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> State>> where ParameterType == Array> { return map { $0.fmap { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> State>> where ParameterType == Effect> { return map { $0.map { $0.fmap(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> State>> where ParameterType == Effect> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> State>> where ParameterType == Effect> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> State>> where ParameterType == Effect> { return map { $0.map { $0.fmap(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> State>> where ParameterType == Effect> { return map { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> State>> where ParameterType == Effect> { + func mapTT (_ transform: @escaping (Input) -> Output) -> State>> where ParameterType == Effect> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> State>> where ParameterType == Effect> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> State>> where ParameterType == Effect> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> State>> where ParameterType == Future> { return map { $0.map { $0.fmap(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> State>> where ParameterType == Future> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> State>> where ParameterType == Future> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> State>> where ParameterType == Future> { return map { $0.map { $0.fmap(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> State>> where ParameterType == Future> { return map { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> State>> where ParameterType == Future> { + func mapTT (_ transform: @escaping (Input) -> Output) -> State>> where ParameterType == Future> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> State>> where ParameterType == Future> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> State>> where ParameterType == Future> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> State>> where ParameterType == Optional> { return map { $0.fmap { $0.fmap(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> State>> where ParameterType == Optional> { return map { $0.fmap { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> State>> where ParameterType == Optional> { return map { $0.fmap { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> State>> where ParameterType == Optional> { return map { $0.fmap { $0.fmap(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> State>> where ParameterType == Optional> { return map { $0.fmap { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> State>> where ParameterType == Optional> { + func mapTT (_ transform: @escaping (Input) -> Output) -> State>> where ParameterType == Optional> { return map { $0.fmap { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> State>> where ParameterType == Optional> { return map { $0.fmap { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> State>> where ParameterType == Optional> { return map { $0.fmap { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> State>> where ParameterType == Reader> { return map { $0.map { $0.fmap(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> State>> where ParameterType == Reader> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> State>> where ParameterType == Reader> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> State>> where ParameterType == Reader> { return map { $0.map { $0.fmap(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> State>> where ParameterType == Reader> { return map { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> State>> where ParameterType == Reader> { + func mapTT (_ transform: @escaping (Input) -> Output) -> State>> where ParameterType == Reader> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> State>> where ParameterType == Reader> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> State>> where ParameterType == Reader> { return map { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> State>> where ParameterType == Result> { + func mapTT (_ transform: @escaping (Input) -> Output) -> State,Secondary2>> where ParameterType == Result,Secondary2> { return map { $0.map { $0.fmap(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> State>> where ParameterType == Result> { + func mapTT (_ transform: @escaping (Input) -> Output) -> State,Secondary2>> where ParameterType == Result,Secondary2> { return map { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> State>> where ParameterType == Result> { + func mapTT (_ transform: @escaping (Input) -> Output) -> State,Secondary2>> where ParameterType == Result,Secondary2> { return map { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> State>> where ParameterType == Result> { + func mapTT (_ transform: @escaping (Input) -> Output) -> State,Secondary2>> where ParameterType == Result,Secondary2> { return map { $0.map { $0.fmap(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> State>> where ParameterType == Result> { + func mapTT (_ transform: @escaping (Input) -> Output) -> State,Secondary2>> where ParameterType == Result,Secondary2> { return map { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> State>> where ParameterType == Result> { + func mapTT (_ transform: @escaping (Input) -> Output) -> State,Secondary2>> where ParameterType == Result,Secondary2> { return map { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> State>> where ParameterType == Result> { + func mapTT (_ transform: @escaping (Input) -> Output) -> State,Secondary2>> where ParameterType == Result,Secondary2> { return map { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> State>> where ParameterType == Result> { + func mapTT (_ transform: @escaping (Input) -> Output) -> State,Secondary2>> where ParameterType == Result,Secondary2> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> State>> where ParameterType == State> { return map { $0.map { $0.fmap(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> State>> where ParameterType == State> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> State>> where ParameterType == State> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> State>> where ParameterType == State> { return map { $0.map { $0.fmap(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> State>> where ParameterType == State> { return map { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> State>> where ParameterType == State> { + func mapTT (_ transform: @escaping (Input) -> Output) -> State>> where ParameterType == State> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> State>> where ParameterType == State> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> State>> where ParameterType == State> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> State>> where ParameterType == Writer> { return map { $0.map { $0.fmap(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> State>> where ParameterType == Writer> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> State>> where ParameterType == Writer> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> State>> where ParameterType == Writer> { return map { $0.map { $0.fmap(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> State>> where ParameterType == Writer> { return map { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> State>> where ParameterType == Writer> { + func mapTT (_ transform: @escaping (Input) -> Output) -> State>> where ParameterType == Writer> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> State>> where ParameterType == Writer> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> State>> where ParameterType == Writer> { return map { $0.map { $0.map(transform) } } } } - - - - -public extension Writer { - - - - - +public extension Writer { func mapTT (_ transform: (Input) -> Output) -> Writer>> where ParameterType == Array> { return map { $0.fmap { $0.fmap(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Writer>> where ParameterType == Array> { return map { $0.fmap { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Writer>> where ParameterType == Array> { return map { $0.fmap { $0.map(transform) } } } - - - - func mapTT (_ transform: (Input) -> Output) -> Writer>> where ParameterType == Array> { return map { $0.fmap { $0.fmap(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Writer>> where ParameterType == Array> { return map { $0.fmap { $0.map(transform) } } } - - - - - func mapTT (_ transform: (Input) -> Output) -> Writer>> where ParameterType == Array> { + func mapTT (_ transform: (Input) -> Output) -> Writer>> where ParameterType == Array> { return map { $0.fmap { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Writer>> where ParameterType == Array> { return map { $0.fmap { $0.map(transform) } } } - - - - func mapTT (_ transform: (Input) -> Output) -> Writer>> where ParameterType == Array> { return map { $0.fmap { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Writer>> where ParameterType == Effect> { return map { $0.map { $0.fmap(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Writer>> where ParameterType == Effect> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Writer>> where ParameterType == Effect> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Writer>> where ParameterType == Effect> { return map { $0.map { $0.fmap(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Writer>> where ParameterType == Effect> { return map { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Writer>> where ParameterType == Effect> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Writer>> where ParameterType == Effect> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Writer>> where ParameterType == Effect> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Writer>> where ParameterType == Effect> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Writer>> where ParameterType == Future> { return map { $0.map { $0.fmap(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Writer>> where ParameterType == Future> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Writer>> where ParameterType == Future> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Writer>> where ParameterType == Future> { return map { $0.map { $0.fmap(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Writer>> where ParameterType == Future> { return map { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Writer>> where ParameterType == Future> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Writer>> where ParameterType == Future> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Writer>> where ParameterType == Future> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Writer>> where ParameterType == Future> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: (Input) -> Output) -> Writer>> where ParameterType == Optional> { return map { $0.fmap { $0.fmap(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Writer>> where ParameterType == Optional> { return map { $0.fmap { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Writer>> where ParameterType == Optional> { return map { $0.fmap { $0.map(transform) } } } - - - - func mapTT (_ transform: (Input) -> Output) -> Writer>> where ParameterType == Optional> { return map { $0.fmap { $0.fmap(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Writer>> where ParameterType == Optional> { return map { $0.fmap { $0.map(transform) } } } - - - - - func mapTT (_ transform: (Input) -> Output) -> Writer>> where ParameterType == Optional> { + func mapTT (_ transform: (Input) -> Output) -> Writer>> where ParameterType == Optional> { return map { $0.fmap { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Writer>> where ParameterType == Optional> { return map { $0.fmap { $0.map(transform) } } } - - - - func mapTT (_ transform: (Input) -> Output) -> Writer>> where ParameterType == Optional> { return map { $0.fmap { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Writer>> where ParameterType == Reader> { return map { $0.map { $0.fmap(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Writer>> where ParameterType == Reader> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Writer>> where ParameterType == Reader> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Writer>> where ParameterType == Reader> { return map { $0.map { $0.fmap(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Writer>> where ParameterType == Reader> { return map { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Writer>> where ParameterType == Reader> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Writer>> where ParameterType == Reader> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Writer>> where ParameterType == Reader> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Writer>> where ParameterType == Reader> { return map { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: (Input) -> Output) -> Writer>> where ParameterType == Result> { + func mapTT (_ transform: (Input) -> Output) -> Writer,Secondary2>> where ParameterType == Result,Secondary2> { return map { $0.map { $0.fmap(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Writer>> where ParameterType == Result> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Writer,Secondary2>> where ParameterType == Result,Secondary2> { return map { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Writer>> where ParameterType == Result> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Writer,Secondary2>> where ParameterType == Result,Secondary2> { return map { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: (Input) -> Output) -> Writer>> where ParameterType == Result> { + func mapTT (_ transform: (Input) -> Output) -> Writer,Secondary2>> where ParameterType == Result,Secondary2> { return map { $0.map { $0.fmap(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Writer>> where ParameterType == Result> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Writer,Secondary2>> where ParameterType == Result,Secondary2> { return map { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: (Input) -> Output) -> Writer>> where ParameterType == Result> { + func mapTT (_ transform: (Input) -> Output) -> Writer,Secondary2>> where ParameterType == Result,Secondary2> { return map { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Writer>> where ParameterType == Result> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Writer,Secondary2>> where ParameterType == Result,Secondary2> { return map { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: (Input) -> Output) -> Writer>> where ParameterType == Result> { + func mapTT (_ transform: (Input) -> Output) -> Writer,Secondary2>> where ParameterType == Result,Secondary2> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Writer>> where ParameterType == State> { return map { $0.map { $0.fmap(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Writer>> where ParameterType == State> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Writer>> where ParameterType == State> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Writer>> where ParameterType == State> { return map { $0.map { $0.fmap(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Writer>> where ParameterType == State> { return map { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Writer>> where ParameterType == State> { + func mapTT (_ transform: @escaping (Input) -> Output) -> Writer>> where ParameterType == State> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Writer>> where ParameterType == State> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Writer>> where ParameterType == State> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: (Input) -> Output) -> Writer>> where ParameterType == Writer> { return map { $0.map { $0.fmap(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Writer>> where ParameterType == Writer> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Writer>> where ParameterType == Writer> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: (Input) -> Output) -> Writer>> where ParameterType == Writer> { return map { $0.map { $0.fmap(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Writer>> where ParameterType == Writer> { return map { $0.map { $0.map(transform) } } } - - - - - func mapTT (_ transform: (Input) -> Output) -> Writer>> where ParameterType == Writer> { + func mapTT (_ transform: (Input) -> Output) -> Writer>> where ParameterType == Writer> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: @escaping (Input) -> Output) -> Writer>> where ParameterType == Writer> { return map { $0.map { $0.map(transform) } } } - - - - func mapTT (_ transform: (Input) -> Output) -> Writer>> where ParameterType == Writer> { return map { $0.map { $0.map(transform) } } } } - - - diff --git a/Sources/FunctionalKit/MonadTransformers2.generated.swift b/Sources/FunctionalKit/MonadTransformers2.generated.swift index 066fa30..45f08ea 100644 --- a/Sources/FunctionalKit/MonadTransformers2.generated.swift +++ b/Sources/FunctionalKit/MonadTransformers2.generated.swift @@ -3,283 +3,157 @@ - - - - - - - - public extension Array { - - - - func flatMapT (_ transform: (Input) -> Array>) -> Array> where ParameterType == Array { return flatMap { (value) -> Array> in value.traverse(transform).fmap { $0.flatMap(f.identity) } } } - - - func flatMapT (_ transform: (Input) -> Array>) -> Array> where ParameterType == Optional { return flatMap { (value) -> Array> in value.traverse(transform).fmap { $0.joined() } } } - - - - func flatMapT (_ transform: (Input) -> Array>) -> Array> where ParameterType == Result { - return flatMap { (value) -> Array> in + func flatMapT (_ transform: (Input) -> Array>) -> Array> where ParameterType == Result { + return flatMap { (value) -> Array> in value.traverse(transform).fmap { $0.joined() } } } - - - - func flatMapT (_ transform: (Input) -> Array>) -> Array> where ParameterType == Writer { - return flatMap { (value) -> Array> in + func flatMapT (_ transform: (Input) -> Array>) -> Array> where ParameterType == Writer { + return flatMap { (value) -> Array> in value.traverse(transform).fmap { $0.joined() } } } } - - - - public extension Effect { - - - - func flatMapT (_ transform: @escaping (Input) -> Effect>) -> Effect> where ParameterType == Array { return flatMap { (value) -> Effect> in value.traverse(transform).map { $0.flatMap(f.identity) } } } - - - func flatMapT (_ transform: @escaping (Input) -> Effect>) -> Effect> where ParameterType == Optional { return flatMap { (value) -> Effect> in value.traverse(transform).map { $0.joined() } } } - - - - func flatMapT (_ transform: @escaping (Input) -> Effect>) -> Effect> where ParameterType == Result { - return flatMap { (value) -> Effect> in + func flatMapT (_ transform: @escaping (Input) -> Effect>) -> Effect> where ParameterType == Result { + return flatMap { (value) -> Effect> in value.traverse(transform).map { $0.joined() } } } - - - - func flatMapT (_ transform: @escaping (Input) -> Effect>) -> Effect> where ParameterType == Writer { - return flatMap { (value) -> Effect> in + func flatMapT (_ transform: @escaping (Input) -> Effect>) -> Effect> where ParameterType == Writer { + return flatMap { (value) -> Effect> in value.traverse(transform).map { $0.joined() } } } } - - - - public extension Future { - - - - func flatMapT (_ transform: @escaping (Input) -> Future>) -> Future> where ParameterType == Array { return flatMap { (value) -> Future> in value.traverse(transform).map { $0.flatMap(f.identity) } } } - - - func flatMapT (_ transform: @escaping (Input) -> Future>) -> Future> where ParameterType == Optional { return flatMap { (value) -> Future> in value.traverse(transform).map { $0.joined() } } } - - - - func flatMapT (_ transform: @escaping (Input) -> Future>) -> Future> where ParameterType == Result { - return flatMap { (value) -> Future> in + func flatMapT (_ transform: @escaping (Input) -> Future>) -> Future> where ParameterType == Result { + return flatMap { (value) -> Future> in value.traverse(transform).map { $0.joined() } } } - - - - func flatMapT (_ transform: @escaping (Input) -> Future>) -> Future> where ParameterType == Writer { - return flatMap { (value) -> Future> in + func flatMapT (_ transform: @escaping (Input) -> Future>) -> Future> where ParameterType == Writer { + return flatMap { (value) -> Future> in value.traverse(transform).map { $0.joined() } } } } - - - - public extension Optional { - - - - func flatMapT (_ transform: (Input) -> Optional>) -> Optional> where ParameterType == Array { return flatMap { (value) -> Optional> in value.traverse(transform).fmap { $0.flatMap(f.identity) } } } - - - func flatMapT (_ transform: (Input) -> Optional>) -> Optional> where ParameterType == Optional { return flatMap { (value) -> Optional> in value.traverse(transform).fmap { $0.joined() } } } - - - - func flatMapT (_ transform: (Input) -> Optional>) -> Optional> where ParameterType == Result { - return flatMap { (value) -> Optional> in + func flatMapT (_ transform: (Input) -> Optional>) -> Optional> where ParameterType == Result { + return flatMap { (value) -> Optional> in value.traverse(transform).fmap { $0.joined() } } } - - - - func flatMapT (_ transform: (Input) -> Optional>) -> Optional> where ParameterType == Writer { - return flatMap { (value) -> Optional> in + func flatMapT (_ transform: (Input) -> Optional>) -> Optional> where ParameterType == Writer { + return flatMap { (value) -> Optional> in value.traverse(transform).fmap { $0.joined() } } } } - - - - public extension Result { - - - - - func flatMapT (_ transform: (Input) -> Result>) -> Result> where ParameterType == Array { - return flatMap { (value) -> Result> in + func flatMapT (_ transform: (Input) -> Result,Failure>) -> Result,Failure> where ParameterType == Array { + return flatMap { (value) -> Result,Failure> in value.traverse(transform).map { $0.flatMap(f.identity) } } } - - - - func flatMapT (_ transform: (Input) -> Result>) -> Result> where ParameterType == Optional { - return flatMap { (value) -> Result> in + func flatMapT (_ transform: (Input) -> Result,Failure>) -> Result,Failure> where ParameterType == Optional { + return flatMap { (value) -> Result,Failure> in value.traverse(transform).map { $0.joined() } } } - - - - func flatMapT (_ transform: (Input) -> Result>) -> Result> where ParameterType == Result { - return flatMap { (value) -> Result> in + func flatMapT (_ transform: (Input) -> Result,Failure>) -> Result,Failure> where ParameterType == Result { + return flatMap { (value) -> Result,Failure> in value.traverse(transform).map { $0.joined() } } } - - - - func flatMapT (_ transform: (Input) -> Result>) -> Result> where ParameterType == Writer { - return flatMap { (value) -> Result> in + func flatMapT (_ transform: (Input) -> Result,Failure>) -> Result,Failure> where ParameterType == Writer { + return flatMap { (value) -> Result,Failure> in value.traverse(transform).map { $0.joined() } } } } - - - - public extension State { - - - - func flatMapT (_ transform: @escaping (Input) -> State>) -> State> where ParameterType == Array { return flatMap { (value) -> State> in value.traverse(transform).map { $0.flatMap(f.identity) } } } - - - func flatMapT (_ transform: @escaping (Input) -> State>) -> State> where ParameterType == Optional { return flatMap { (value) -> State> in value.traverse(transform).map { $0.joined() } } } - - - - func flatMapT (_ transform: @escaping (Input) -> State>) -> State> where ParameterType == Result { - return flatMap { (value) -> State> in + func flatMapT (_ transform: @escaping (Input) -> State>) -> State> where ParameterType == Result { + return flatMap { (value) -> State> in value.traverse(transform).map { $0.joined() } } } - - - - func flatMapT (_ transform: @escaping (Input) -> State>) -> State> where ParameterType == Writer { - return flatMap { (value) -> State> in + func flatMapT (_ transform: @escaping (Input) -> State>) -> State> where ParameterType == Writer { + return flatMap { (value) -> State> in value.traverse(transform).map { $0.joined() } } } } - - - - public extension Writer { - - - - func flatMapT (_ transform: (Input) -> Writer>) -> Writer> where ParameterType == Array { return flatMap { (value) -> Writer> in value.traverse(transform).map { $0.flatMap(f.identity) } } } - - - func flatMapT (_ transform: (Input) -> Writer>) -> Writer> where ParameterType == Optional { return flatMap { (value) -> Writer> in value.traverse(transform).map { $0.joined() } } } - - - - func flatMapT (_ transform: (Input) -> Writer>) -> Writer> where ParameterType == Result { - return flatMap { (value) -> Writer> in + func flatMapT (_ transform: (Input) -> Writer>) -> Writer> where ParameterType == Result { + return flatMap { (value) -> Writer> in value.traverse(transform).map { $0.joined() } } } - - - - func flatMapT (_ transform: (Input) -> Writer>) -> Writer> where ParameterType == Writer { - return flatMap { (value) -> Writer> in + func flatMapT (_ transform: (Input) -> Writer>) -> Writer> where ParameterType == Writer { + return flatMap { (value) -> Writer> in value.traverse(transform).map { $0.joined() } } } } - - - diff --git a/Sources/FunctionalKit/MonadTransformers3.generated.swift b/Sources/FunctionalKit/MonadTransformers3.generated.swift index 15b2e7f..99bd0e6 100644 --- a/Sources/FunctionalKit/MonadTransformers3.generated.swift +++ b/Sources/FunctionalKit/MonadTransformers3.generated.swift @@ -3,155 +3,82 @@ - - - - - - - - public extension Array { - - - - - func flatMapTT (_ transform: (Input) -> Array>>) -> Array>> where ParameterType == Array> { return flatMapT { (value) -> Array>> in value.traverse(transform).fmap { $0.traverse(f.identity) }.mapT { $0.flatMap(f.identity) } } } - - - - func flatMapTT (_ transform: (Input) -> Array>>) -> Array>> where ParameterType == Array> { return flatMapT { (value) -> Array>> in value.traverse(transform).fmap { $0.traverse(f.identity) }.mapT { $0.joined() } } } - - - - - func flatMapTT (_ transform: (Input) -> Array>>) -> Array>> where ParameterType == Array> { - return flatMapT { (value) -> Array>> in + func flatMapTT (_ transform: (Input) -> Array>>) -> Array>> where ParameterType == Array> { + return flatMapT { (value) -> Array>> in value.traverse(transform).fmap { $0.traverse(f.identity) }.mapT { $0.joined() } } } - - - - func flatMapTT (_ transform: (Input) -> Array>>) -> Array>> where ParameterType == Array> { return flatMapT { (value) -> Array>> in value.traverse(transform).fmap { $0.traverse(f.identity) }.mapT { $0.joined() } } } - - - - func flatMapTT (_ transform: (Input) -> Array>>) -> Array>> where ParameterType == Optional> { return flatMapT { (value) -> Array>> in value.traverse(transform).fmap { $0.traverse(f.identity) }.mapT { $0.flatMap(f.identity) } } } - - - - func flatMapTT (_ transform: (Input) -> Array>>) -> Array>> where ParameterType == Optional> { return flatMapT { (value) -> Array>> in value.traverse(transform).fmap { $0.traverse(f.identity) }.mapT { $0.joined() } } } - - - - - func flatMapTT (_ transform: (Input) -> Array>>) -> Array>> where ParameterType == Optional> { - return flatMapT { (value) -> Array>> in + func flatMapTT (_ transform: (Input) -> Array>>) -> Array>> where ParameterType == Optional> { + return flatMapT { (value) -> Array>> in value.traverse(transform).fmap { $0.traverse(f.identity) }.mapT { $0.joined() } } } - - - - func flatMapTT (_ transform: (Input) -> Array>>) -> Array>> where ParameterType == Optional> { return flatMapT { (value) -> Array>> in value.traverse(transform).fmap { $0.traverse(f.identity) }.mapT { $0.joined() } } } - - - - - func flatMapTT (_ transform: (Input) -> Array>>) -> Array>> where ParameterType == Result> { - return flatMapT { (value) -> Array>> in + func flatMapTT (_ transform: (Input) -> Array,Secondary2>>) -> Array,Secondary2>> where ParameterType == Result,Secondary2> { + return flatMapT { (value) -> Array,Secondary2>> in value.traverse(transform).fmap { $0.traverse(f.identity) }.mapT { $0.flatMap(f.identity) } } } - - - - - func flatMapTT (_ transform: (Input) -> Array>>) -> Array>> where ParameterType == Result> { - return flatMapT { (value) -> Array>> in + func flatMapTT (_ transform: (Input) -> Array,Secondary2>>) -> Array,Secondary2>> where ParameterType == Result,Secondary2> { + return flatMapT { (value) -> Array,Secondary2>> in value.traverse(transform).fmap { $0.traverse(f.identity) }.mapT { $0.joined() } } } - - - - - func flatMapTT (_ transform: (Input) -> Array>>) -> Array>> where ParameterType == Result> { - return flatMapT { (value) -> Array>> in + func flatMapTT (_ transform: (Input) -> Array,Secondary2>>) -> Array,Secondary2>> where ParameterType == Result,Secondary2> { + return flatMapT { (value) -> Array,Secondary2>> in value.traverse(transform).fmap { $0.traverse(f.identity) }.mapT { $0.joined() } } } - - - - - func flatMapTT (_ transform: (Input) -> Array>>) -> Array>> where ParameterType == Result> { - return flatMapT { (value) -> Array>> in + func flatMapTT (_ transform: (Input) -> Array,Secondary2>>) -> Array,Secondary2>> where ParameterType == Result,Secondary2> { + return flatMapT { (value) -> Array,Secondary2>> in value.traverse(transform).fmap { $0.traverse(f.identity) }.mapT { $0.joined() } } } - - - - func flatMapTT (_ transform: (Input) -> Array>>) -> Array>> where ParameterType == Writer> { return flatMapT { (value) -> Array>> in value.traverse(transform).fmap { $0.traverse(f.identity) }.mapT { $0.flatMap(f.identity) } } } - - - - func flatMapTT (_ transform: (Input) -> Array>>) -> Array>> where ParameterType == Writer> { return flatMapT { (value) -> Array>> in value.traverse(transform).fmap { $0.traverse(f.identity) }.mapT { $0.joined() } } } - - - - - func flatMapTT (_ transform: (Input) -> Array>>) -> Array>> where ParameterType == Writer> { - return flatMapT { (value) -> Array>> in + func flatMapTT (_ transform: (Input) -> Array>>) -> Array>> where ParameterType == Writer> { + return flatMapT { (value) -> Array>> in value.traverse(transform).fmap { $0.traverse(f.identity) }.mapT { $0.joined() } } } - - - - func flatMapTT (_ transform: (Input) -> Array>>) -> Array>> where ParameterType == Writer> { return flatMapT { (value) -> Array>> in value.traverse(transform).fmap { $0.traverse(f.identity) }.mapT { $0.joined() } @@ -161,148 +88,82 @@ public extension Array { - public extension Effect { - - - - - func flatMapTT (_ transform: @escaping (Input) -> Effect>>) -> Effect>> where ParameterType == Array> { return flatMapT { (value) -> Effect>> in value.traverse(transform).map { $0.traverse(f.identity) }.mapT { $0.flatMap(f.identity) } } } - - - - func flatMapTT (_ transform: @escaping (Input) -> Effect>>) -> Effect>> where ParameterType == Array> { return flatMapT { (value) -> Effect>> in value.traverse(transform).map { $0.traverse(f.identity) }.mapT { $0.joined() } } } - - - - - func flatMapTT (_ transform: @escaping (Input) -> Effect>>) -> Effect>> where ParameterType == Array> { - return flatMapT { (value) -> Effect>> in + func flatMapTT (_ transform: @escaping (Input) -> Effect>>) -> Effect>> where ParameterType == Array> { + return flatMapT { (value) -> Effect>> in value.traverse(transform).map { $0.traverse(f.identity) }.mapT { $0.joined() } } } - - - - func flatMapTT (_ transform: @escaping (Input) -> Effect>>) -> Effect>> where ParameterType == Array> { return flatMapT { (value) -> Effect>> in value.traverse(transform).map { $0.traverse(f.identity) }.mapT { $0.joined() } } } - - - - func flatMapTT (_ transform: @escaping (Input) -> Effect>>) -> Effect>> where ParameterType == Optional> { return flatMapT { (value) -> Effect>> in value.traverse(transform).map { $0.traverse(f.identity) }.mapT { $0.flatMap(f.identity) } } } - - - - func flatMapTT (_ transform: @escaping (Input) -> Effect>>) -> Effect>> where ParameterType == Optional> { return flatMapT { (value) -> Effect>> in value.traverse(transform).map { $0.traverse(f.identity) }.mapT { $0.joined() } } } - - - - - func flatMapTT (_ transform: @escaping (Input) -> Effect>>) -> Effect>> where ParameterType == Optional> { - return flatMapT { (value) -> Effect>> in + func flatMapTT (_ transform: @escaping (Input) -> Effect>>) -> Effect>> where ParameterType == Optional> { + return flatMapT { (value) -> Effect>> in value.traverse(transform).map { $0.traverse(f.identity) }.mapT { $0.joined() } } } - - - - func flatMapTT (_ transform: @escaping (Input) -> Effect>>) -> Effect>> where ParameterType == Optional> { return flatMapT { (value) -> Effect>> in value.traverse(transform).map { $0.traverse(f.identity) }.mapT { $0.joined() } } } - - - - - func flatMapTT (_ transform: @escaping (Input) -> Effect>>) -> Effect>> where ParameterType == Result> { - return flatMapT { (value) -> Effect>> in + func flatMapTT (_ transform: @escaping (Input) -> Effect,Secondary2>>) -> Effect,Secondary2>> where ParameterType == Result,Secondary2> { + return flatMapT { (value) -> Effect,Secondary2>> in value.traverse(transform).map { $0.traverse(f.identity) }.mapT { $0.flatMap(f.identity) } } } - - - - - func flatMapTT (_ transform: @escaping (Input) -> Effect>>) -> Effect>> where ParameterType == Result> { - return flatMapT { (value) -> Effect>> in + func flatMapTT (_ transform: @escaping (Input) -> Effect,Secondary2>>) -> Effect,Secondary2>> where ParameterType == Result,Secondary2> { + return flatMapT { (value) -> Effect,Secondary2>> in value.traverse(transform).map { $0.traverse(f.identity) }.mapT { $0.joined() } } } - - - - - func flatMapTT (_ transform: @escaping (Input) -> Effect>>) -> Effect>> where ParameterType == Result> { - return flatMapT { (value) -> Effect>> in + func flatMapTT (_ transform: @escaping (Input) -> Effect,Secondary2>>) -> Effect,Secondary2>> where ParameterType == Result,Secondary2> { + return flatMapT { (value) -> Effect,Secondary2>> in value.traverse(transform).map { $0.traverse(f.identity) }.mapT { $0.joined() } } } - - - - - func flatMapTT (_ transform: @escaping (Input) -> Effect>>) -> Effect>> where ParameterType == Result> { - return flatMapT { (value) -> Effect>> in + func flatMapTT (_ transform: @escaping (Input) -> Effect,Secondary2>>) -> Effect,Secondary2>> where ParameterType == Result,Secondary2> { + return flatMapT { (value) -> Effect,Secondary2>> in value.traverse(transform).map { $0.traverse(f.identity) }.mapT { $0.joined() } } } - - - - func flatMapTT (_ transform: @escaping (Input) -> Effect>>) -> Effect>> where ParameterType == Writer> { return flatMapT { (value) -> Effect>> in value.traverse(transform).map { $0.traverse(f.identity) }.mapT { $0.flatMap(f.identity) } } } - - - - func flatMapTT (_ transform: @escaping (Input) -> Effect>>) -> Effect>> where ParameterType == Writer> { return flatMapT { (value) -> Effect>> in value.traverse(transform).map { $0.traverse(f.identity) }.mapT { $0.joined() } } } - - - - - func flatMapTT (_ transform: @escaping (Input) -> Effect>>) -> Effect>> where ParameterType == Writer> { - return flatMapT { (value) -> Effect>> in + func flatMapTT (_ transform: @escaping (Input) -> Effect>>) -> Effect>> where ParameterType == Writer> { + return flatMapT { (value) -> Effect>> in value.traverse(transform).map { $0.traverse(f.identity) }.mapT { $0.joined() } } } - - - - func flatMapTT (_ transform: @escaping (Input) -> Effect>>) -> Effect>> where ParameterType == Writer> { return flatMapT { (value) -> Effect>> in value.traverse(transform).map { $0.traverse(f.identity) }.mapT { $0.joined() } @@ -312,148 +173,82 @@ public extension Effect { - public extension Future { - - - - - func flatMapTT (_ transform: @escaping (Input) -> Future>>) -> Future>> where ParameterType == Array> { return flatMapT { (value) -> Future>> in value.traverse(transform).map { $0.traverse(f.identity) }.mapT { $0.flatMap(f.identity) } } } - - - - func flatMapTT (_ transform: @escaping (Input) -> Future>>) -> Future>> where ParameterType == Array> { return flatMapT { (value) -> Future>> in value.traverse(transform).map { $0.traverse(f.identity) }.mapT { $0.joined() } } } - - - - - func flatMapTT (_ transform: @escaping (Input) -> Future>>) -> Future>> where ParameterType == Array> { - return flatMapT { (value) -> Future>> in + func flatMapTT (_ transform: @escaping (Input) -> Future>>) -> Future>> where ParameterType == Array> { + return flatMapT { (value) -> Future>> in value.traverse(transform).map { $0.traverse(f.identity) }.mapT { $0.joined() } } } - - - - func flatMapTT (_ transform: @escaping (Input) -> Future>>) -> Future>> where ParameterType == Array> { return flatMapT { (value) -> Future>> in value.traverse(transform).map { $0.traverse(f.identity) }.mapT { $0.joined() } } } - - - - func flatMapTT (_ transform: @escaping (Input) -> Future>>) -> Future>> where ParameterType == Optional> { return flatMapT { (value) -> Future>> in value.traverse(transform).map { $0.traverse(f.identity) }.mapT { $0.flatMap(f.identity) } } } - - - - func flatMapTT (_ transform: @escaping (Input) -> Future>>) -> Future>> where ParameterType == Optional> { return flatMapT { (value) -> Future>> in value.traverse(transform).map { $0.traverse(f.identity) }.mapT { $0.joined() } } } - - - - - func flatMapTT (_ transform: @escaping (Input) -> Future>>) -> Future>> where ParameterType == Optional> { - return flatMapT { (value) -> Future>> in + func flatMapTT (_ transform: @escaping (Input) -> Future>>) -> Future>> where ParameterType == Optional> { + return flatMapT { (value) -> Future>> in value.traverse(transform).map { $0.traverse(f.identity) }.mapT { $0.joined() } } } - - - - func flatMapTT (_ transform: @escaping (Input) -> Future>>) -> Future>> where ParameterType == Optional> { return flatMapT { (value) -> Future>> in value.traverse(transform).map { $0.traverse(f.identity) }.mapT { $0.joined() } } } - - - - - func flatMapTT (_ transform: @escaping (Input) -> Future>>) -> Future>> where ParameterType == Result> { - return flatMapT { (value) -> Future>> in + func flatMapTT (_ transform: @escaping (Input) -> Future,Secondary2>>) -> Future,Secondary2>> where ParameterType == Result,Secondary2> { + return flatMapT { (value) -> Future,Secondary2>> in value.traverse(transform).map { $0.traverse(f.identity) }.mapT { $0.flatMap(f.identity) } } } - - - - - func flatMapTT (_ transform: @escaping (Input) -> Future>>) -> Future>> where ParameterType == Result> { - return flatMapT { (value) -> Future>> in + func flatMapTT (_ transform: @escaping (Input) -> Future,Secondary2>>) -> Future,Secondary2>> where ParameterType == Result,Secondary2> { + return flatMapT { (value) -> Future,Secondary2>> in value.traverse(transform).map { $0.traverse(f.identity) }.mapT { $0.joined() } } } - - - - - func flatMapTT (_ transform: @escaping (Input) -> Future>>) -> Future>> where ParameterType == Result> { - return flatMapT { (value) -> Future>> in + func flatMapTT (_ transform: @escaping (Input) -> Future,Secondary2>>) -> Future,Secondary2>> where ParameterType == Result,Secondary2> { + return flatMapT { (value) -> Future,Secondary2>> in value.traverse(transform).map { $0.traverse(f.identity) }.mapT { $0.joined() } } } - - - - - func flatMapTT (_ transform: @escaping (Input) -> Future>>) -> Future>> where ParameterType == Result> { - return flatMapT { (value) -> Future>> in + func flatMapTT (_ transform: @escaping (Input) -> Future,Secondary2>>) -> Future,Secondary2>> where ParameterType == Result,Secondary2> { + return flatMapT { (value) -> Future,Secondary2>> in value.traverse(transform).map { $0.traverse(f.identity) }.mapT { $0.joined() } } } - - - - func flatMapTT (_ transform: @escaping (Input) -> Future>>) -> Future>> where ParameterType == Writer> { return flatMapT { (value) -> Future>> in value.traverse(transform).map { $0.traverse(f.identity) }.mapT { $0.flatMap(f.identity) } } } - - - - func flatMapTT (_ transform: @escaping (Input) -> Future>>) -> Future>> where ParameterType == Writer> { return flatMapT { (value) -> Future>> in value.traverse(transform).map { $0.traverse(f.identity) }.mapT { $0.joined() } } } - - - - - func flatMapTT (_ transform: @escaping (Input) -> Future>>) -> Future>> where ParameterType == Writer> { - return flatMapT { (value) -> Future>> in + func flatMapTT (_ transform: @escaping (Input) -> Future>>) -> Future>> where ParameterType == Writer> { + return flatMapT { (value) -> Future>> in value.traverse(transform).map { $0.traverse(f.identity) }.mapT { $0.joined() } } } - - - - func flatMapTT (_ transform: @escaping (Input) -> Future>>) -> Future>> where ParameterType == Writer> { return flatMapT { (value) -> Future>> in value.traverse(transform).map { $0.traverse(f.identity) }.mapT { $0.joined() } @@ -463,148 +258,82 @@ public extension Future { - public extension Optional { - - - - - func flatMapTT (_ transform: (Input) -> Optional>>) -> Optional>> where ParameterType == Array> { return flatMapT { (value) -> Optional>> in value.traverse(transform).fmap { $0.traverse(f.identity) }.mapT { $0.flatMap(f.identity) } } } - - - - func flatMapTT (_ transform: (Input) -> Optional>>) -> Optional>> where ParameterType == Array> { return flatMapT { (value) -> Optional>> in value.traverse(transform).fmap { $0.traverse(f.identity) }.mapT { $0.joined() } } } - - - - - func flatMapTT (_ transform: (Input) -> Optional>>) -> Optional>> where ParameterType == Array> { - return flatMapT { (value) -> Optional>> in + func flatMapTT (_ transform: (Input) -> Optional>>) -> Optional>> where ParameterType == Array> { + return flatMapT { (value) -> Optional>> in value.traverse(transform).fmap { $0.traverse(f.identity) }.mapT { $0.joined() } } } - - - - func flatMapTT (_ transform: (Input) -> Optional>>) -> Optional>> where ParameterType == Array> { return flatMapT { (value) -> Optional>> in value.traverse(transform).fmap { $0.traverse(f.identity) }.mapT { $0.joined() } } } - - - - func flatMapTT (_ transform: (Input) -> Optional>>) -> Optional>> where ParameterType == Optional> { return flatMapT { (value) -> Optional>> in value.traverse(transform).fmap { $0.traverse(f.identity) }.mapT { $0.flatMap(f.identity) } } } - - - - func flatMapTT (_ transform: (Input) -> Optional>>) -> Optional>> where ParameterType == Optional> { return flatMapT { (value) -> Optional>> in value.traverse(transform).fmap { $0.traverse(f.identity) }.mapT { $0.joined() } } } - - - - - func flatMapTT (_ transform: (Input) -> Optional>>) -> Optional>> where ParameterType == Optional> { - return flatMapT { (value) -> Optional>> in + func flatMapTT (_ transform: (Input) -> Optional>>) -> Optional>> where ParameterType == Optional> { + return flatMapT { (value) -> Optional>> in value.traverse(transform).fmap { $0.traverse(f.identity) }.mapT { $0.joined() } } } - - - - func flatMapTT (_ transform: (Input) -> Optional>>) -> Optional>> where ParameterType == Optional> { return flatMapT { (value) -> Optional>> in value.traverse(transform).fmap { $0.traverse(f.identity) }.mapT { $0.joined() } } } - - - - - func flatMapTT (_ transform: (Input) -> Optional>>) -> Optional>> where ParameterType == Result> { - return flatMapT { (value) -> Optional>> in + func flatMapTT (_ transform: (Input) -> Optional,Secondary2>>) -> Optional,Secondary2>> where ParameterType == Result,Secondary2> { + return flatMapT { (value) -> Optional,Secondary2>> in value.traverse(transform).fmap { $0.traverse(f.identity) }.mapT { $0.flatMap(f.identity) } } } - - - - - func flatMapTT (_ transform: (Input) -> Optional>>) -> Optional>> where ParameterType == Result> { - return flatMapT { (value) -> Optional>> in + func flatMapTT (_ transform: (Input) -> Optional,Secondary2>>) -> Optional,Secondary2>> where ParameterType == Result,Secondary2> { + return flatMapT { (value) -> Optional,Secondary2>> in value.traverse(transform).fmap { $0.traverse(f.identity) }.mapT { $0.joined() } } } - - - - - func flatMapTT (_ transform: (Input) -> Optional>>) -> Optional>> where ParameterType == Result> { - return flatMapT { (value) -> Optional>> in + func flatMapTT (_ transform: (Input) -> Optional,Secondary2>>) -> Optional,Secondary2>> where ParameterType == Result,Secondary2> { + return flatMapT { (value) -> Optional,Secondary2>> in value.traverse(transform).fmap { $0.traverse(f.identity) }.mapT { $0.joined() } } } - - - - - func flatMapTT (_ transform: (Input) -> Optional>>) -> Optional>> where ParameterType == Result> { - return flatMapT { (value) -> Optional>> in + func flatMapTT (_ transform: (Input) -> Optional,Secondary2>>) -> Optional,Secondary2>> where ParameterType == Result,Secondary2> { + return flatMapT { (value) -> Optional,Secondary2>> in value.traverse(transform).fmap { $0.traverse(f.identity) }.mapT { $0.joined() } } } - - - - func flatMapTT (_ transform: (Input) -> Optional>>) -> Optional>> where ParameterType == Writer> { return flatMapT { (value) -> Optional>> in value.traverse(transform).fmap { $0.traverse(f.identity) }.mapT { $0.flatMap(f.identity) } } } - - - - func flatMapTT (_ transform: (Input) -> Optional>>) -> Optional>> where ParameterType == Writer> { return flatMapT { (value) -> Optional>> in value.traverse(transform).fmap { $0.traverse(f.identity) }.mapT { $0.joined() } } } - - - - - func flatMapTT (_ transform: (Input) -> Optional>>) -> Optional>> where ParameterType == Writer> { - return flatMapT { (value) -> Optional>> in + func flatMapTT (_ transform: (Input) -> Optional>>) -> Optional>> where ParameterType == Writer> { + return flatMapT { (value) -> Optional>> in value.traverse(transform).fmap { $0.traverse(f.identity) }.mapT { $0.joined() } } } - - - - func flatMapTT (_ transform: (Input) -> Optional>>) -> Optional>> where ParameterType == Writer> { return flatMapT { (value) -> Optional>> in value.traverse(transform).fmap { $0.traverse(f.identity) }.mapT { $0.joined() } @@ -614,150 +343,84 @@ public extension Optional { - public extension Result { - - - - - - func flatMapTT (_ transform: (Input) -> Result>>) -> Result>> where ParameterType == Array> { - return flatMapT { (value) -> Result>> in + func flatMapTT (_ transform: (Input) -> Result>,Failure>) -> Result>,Failure> where ParameterType == Array> { + return flatMapT { (value) -> Result>,Failure> in value.traverse(transform).map { $0.traverse(f.identity) }.mapT { $0.flatMap(f.identity) } } } - - - - - func flatMapTT (_ transform: (Input) -> Result>>) -> Result>> where ParameterType == Array> { - return flatMapT { (value) -> Result>> in + func flatMapTT (_ transform: (Input) -> Result>,Failure>) -> Result>,Failure> where ParameterType == Array> { + return flatMapT { (value) -> Result>,Failure> in value.traverse(transform).map { $0.traverse(f.identity) }.mapT { $0.joined() } } } - - - - - func flatMapTT (_ transform: (Input) -> Result>>) -> Result>> where ParameterType == Array> { - return flatMapT { (value) -> Result>> in + func flatMapTT (_ transform: (Input) -> Result>,Failure>) -> Result>,Failure> where ParameterType == Array> { + return flatMapT { (value) -> Result>,Failure> in value.traverse(transform).map { $0.traverse(f.identity) }.mapT { $0.joined() } } } - - - - - func flatMapTT (_ transform: (Input) -> Result>>) -> Result>> where ParameterType == Array> { - return flatMapT { (value) -> Result>> in + func flatMapTT (_ transform: (Input) -> Result>,Failure>) -> Result>,Failure> where ParameterType == Array> { + return flatMapT { (value) -> Result>,Failure> in value.traverse(transform).map { $0.traverse(f.identity) }.mapT { $0.joined() } } } - - - - - func flatMapTT (_ transform: (Input) -> Result>>) -> Result>> where ParameterType == Optional> { - return flatMapT { (value) -> Result>> in + func flatMapTT (_ transform: (Input) -> Result>,Failure>) -> Result>,Failure> where ParameterType == Optional> { + return flatMapT { (value) -> Result>,Failure> in value.traverse(transform).map { $0.traverse(f.identity) }.mapT { $0.flatMap(f.identity) } } } - - - - - func flatMapTT (_ transform: (Input) -> Result>>) -> Result>> where ParameterType == Optional> { - return flatMapT { (value) -> Result>> in + func flatMapTT (_ transform: (Input) -> Result>,Failure>) -> Result>,Failure> where ParameterType == Optional> { + return flatMapT { (value) -> Result>,Failure> in value.traverse(transform).map { $0.traverse(f.identity) }.mapT { $0.joined() } } } - - - - - func flatMapTT (_ transform: (Input) -> Result>>) -> Result>> where ParameterType == Optional> { - return flatMapT { (value) -> Result>> in + func flatMapTT (_ transform: (Input) -> Result>,Failure>) -> Result>,Failure> where ParameterType == Optional> { + return flatMapT { (value) -> Result>,Failure> in value.traverse(transform).map { $0.traverse(f.identity) }.mapT { $0.joined() } } } - - - - - func flatMapTT (_ transform: (Input) -> Result>>) -> Result>> where ParameterType == Optional> { - return flatMapT { (value) -> Result>> in + func flatMapTT (_ transform: (Input) -> Result>,Failure>) -> Result>,Failure> where ParameterType == Optional> { + return flatMapT { (value) -> Result>,Failure> in value.traverse(transform).map { $0.traverse(f.identity) }.mapT { $0.joined() } } } - - - - - func flatMapTT (_ transform: (Input) -> Result>>) -> Result>> where ParameterType == Result> { - return flatMapT { (value) -> Result>> in + func flatMapTT (_ transform: (Input) -> Result,Secondary2>,Failure>) -> Result,Secondary2>,Failure> where ParameterType == Result,Secondary2> { + return flatMapT { (value) -> Result,Secondary2>,Failure> in value.traverse(transform).map { $0.traverse(f.identity) }.mapT { $0.flatMap(f.identity) } } } - - - - - func flatMapTT (_ transform: (Input) -> Result>>) -> Result>> where ParameterType == Result> { - return flatMapT { (value) -> Result>> in + func flatMapTT (_ transform: (Input) -> Result,Secondary2>,Failure>) -> Result,Secondary2>,Failure> where ParameterType == Result,Secondary2> { + return flatMapT { (value) -> Result,Secondary2>,Failure> in value.traverse(transform).map { $0.traverse(f.identity) }.mapT { $0.joined() } } } - - - - - func flatMapTT (_ transform: (Input) -> Result>>) -> Result>> where ParameterType == Result> { - return flatMapT { (value) -> Result>> in + func flatMapTT (_ transform: (Input) -> Result,Secondary2>,Failure>) -> Result,Secondary2>,Failure> where ParameterType == Result,Secondary2> { + return flatMapT { (value) -> Result,Secondary2>,Failure> in value.traverse(transform).map { $0.traverse(f.identity) }.mapT { $0.joined() } } } - - - - - func flatMapTT (_ transform: (Input) -> Result>>) -> Result>> where ParameterType == Result> { - return flatMapT { (value) -> Result>> in + func flatMapTT (_ transform: (Input) -> Result,Secondary2>,Failure>) -> Result,Secondary2>,Failure> where ParameterType == Result,Secondary2> { + return flatMapT { (value) -> Result,Secondary2>,Failure> in value.traverse(transform).map { $0.traverse(f.identity) }.mapT { $0.joined() } } } - - - - - func flatMapTT (_ transform: (Input) -> Result>>) -> Result>> where ParameterType == Writer> { - return flatMapT { (value) -> Result>> in + func flatMapTT (_ transform: (Input) -> Result>,Failure>) -> Result>,Failure> where ParameterType == Writer> { + return flatMapT { (value) -> Result>,Failure> in value.traverse(transform).map { $0.traverse(f.identity) }.mapT { $0.flatMap(f.identity) } } } - - - - - func flatMapTT (_ transform: (Input) -> Result>>) -> Result>> where ParameterType == Writer> { - return flatMapT { (value) -> Result>> in + func flatMapTT (_ transform: (Input) -> Result>,Failure>) -> Result>,Failure> where ParameterType == Writer> { + return flatMapT { (value) -> Result>,Failure> in value.traverse(transform).map { $0.traverse(f.identity) }.mapT { $0.joined() } } } - - - - - func flatMapTT (_ transform: (Input) -> Result>>) -> Result>> where ParameterType == Writer> { - return flatMapT { (value) -> Result>> in + func flatMapTT (_ transform: (Input) -> Result>,Failure>) -> Result>,Failure> where ParameterType == Writer> { + return flatMapT { (value) -> Result>,Failure> in value.traverse(transform).map { $0.traverse(f.identity) }.mapT { $0.joined() } } } - - - - - func flatMapTT (_ transform: (Input) -> Result>>) -> Result>> where ParameterType == Writer> { - return flatMapT { (value) -> Result>> in + func flatMapTT (_ transform: (Input) -> Result>,Failure>) -> Result>,Failure> where ParameterType == Writer> { + return flatMapT { (value) -> Result>,Failure> in value.traverse(transform).map { $0.traverse(f.identity) }.mapT { $0.joined() } } } @@ -765,148 +428,82 @@ public extension Result { - public extension State { - - - - - func flatMapTT (_ transform: @escaping (Input) -> State>>) -> State>> where ParameterType == Array> { return flatMapT { (value) -> State>> in value.traverse(transform).map { $0.traverse(f.identity) }.mapT { $0.flatMap(f.identity) } } } - - - - func flatMapTT (_ transform: @escaping (Input) -> State>>) -> State>> where ParameterType == Array> { return flatMapT { (value) -> State>> in value.traverse(transform).map { $0.traverse(f.identity) }.mapT { $0.joined() } } } - - - - - func flatMapTT (_ transform: @escaping (Input) -> State>>) -> State>> where ParameterType == Array> { - return flatMapT { (value) -> State>> in + func flatMapTT (_ transform: @escaping (Input) -> State>>) -> State>> where ParameterType == Array> { + return flatMapT { (value) -> State>> in value.traverse(transform).map { $0.traverse(f.identity) }.mapT { $0.joined() } } } - - - - func flatMapTT (_ transform: @escaping (Input) -> State>>) -> State>> where ParameterType == Array> { return flatMapT { (value) -> State>> in value.traverse(transform).map { $0.traverse(f.identity) }.mapT { $0.joined() } } } - - - - func flatMapTT (_ transform: @escaping (Input) -> State>>) -> State>> where ParameterType == Optional> { return flatMapT { (value) -> State>> in value.traverse(transform).map { $0.traverse(f.identity) }.mapT { $0.flatMap(f.identity) } } } - - - - func flatMapTT (_ transform: @escaping (Input) -> State>>) -> State>> where ParameterType == Optional> { return flatMapT { (value) -> State>> in value.traverse(transform).map { $0.traverse(f.identity) }.mapT { $0.joined() } } } - - - - - func flatMapTT (_ transform: @escaping (Input) -> State>>) -> State>> where ParameterType == Optional> { - return flatMapT { (value) -> State>> in + func flatMapTT (_ transform: @escaping (Input) -> State>>) -> State>> where ParameterType == Optional> { + return flatMapT { (value) -> State>> in value.traverse(transform).map { $0.traverse(f.identity) }.mapT { $0.joined() } } } - - - - func flatMapTT (_ transform: @escaping (Input) -> State>>) -> State>> where ParameterType == Optional> { return flatMapT { (value) -> State>> in value.traverse(transform).map { $0.traverse(f.identity) }.mapT { $0.joined() } } } - - - - - func flatMapTT (_ transform: @escaping (Input) -> State>>) -> State>> where ParameterType == Result> { - return flatMapT { (value) -> State>> in + func flatMapTT (_ transform: @escaping (Input) -> State,Secondary2>>) -> State,Secondary2>> where ParameterType == Result,Secondary2> { + return flatMapT { (value) -> State,Secondary2>> in value.traverse(transform).map { $0.traverse(f.identity) }.mapT { $0.flatMap(f.identity) } } } - - - - - func flatMapTT (_ transform: @escaping (Input) -> State>>) -> State>> where ParameterType == Result> { - return flatMapT { (value) -> State>> in + func flatMapTT (_ transform: @escaping (Input) -> State,Secondary2>>) -> State,Secondary2>> where ParameterType == Result,Secondary2> { + return flatMapT { (value) -> State,Secondary2>> in value.traverse(transform).map { $0.traverse(f.identity) }.mapT { $0.joined() } } } - - - - - func flatMapTT (_ transform: @escaping (Input) -> State>>) -> State>> where ParameterType == Result> { - return flatMapT { (value) -> State>> in + func flatMapTT (_ transform: @escaping (Input) -> State,Secondary2>>) -> State,Secondary2>> where ParameterType == Result,Secondary2> { + return flatMapT { (value) -> State,Secondary2>> in value.traverse(transform).map { $0.traverse(f.identity) }.mapT { $0.joined() } } } - - - - - func flatMapTT (_ transform: @escaping (Input) -> State>>) -> State>> where ParameterType == Result> { - return flatMapT { (value) -> State>> in + func flatMapTT (_ transform: @escaping (Input) -> State,Secondary2>>) -> State,Secondary2>> where ParameterType == Result,Secondary2> { + return flatMapT { (value) -> State,Secondary2>> in value.traverse(transform).map { $0.traverse(f.identity) }.mapT { $0.joined() } } } - - - - func flatMapTT (_ transform: @escaping (Input) -> State>>) -> State>> where ParameterType == Writer> { return flatMapT { (value) -> State>> in value.traverse(transform).map { $0.traverse(f.identity) }.mapT { $0.flatMap(f.identity) } } } - - - - func flatMapTT (_ transform: @escaping (Input) -> State>>) -> State>> where ParameterType == Writer> { return flatMapT { (value) -> State>> in value.traverse(transform).map { $0.traverse(f.identity) }.mapT { $0.joined() } } } - - - - - func flatMapTT (_ transform: @escaping (Input) -> State>>) -> State>> where ParameterType == Writer> { - return flatMapT { (value) -> State>> in + func flatMapTT (_ transform: @escaping (Input) -> State>>) -> State>> where ParameterType == Writer> { + return flatMapT { (value) -> State>> in value.traverse(transform).map { $0.traverse(f.identity) }.mapT { $0.joined() } } } - - - - func flatMapTT (_ transform: @escaping (Input) -> State>>) -> State>> where ParameterType == Writer> { return flatMapT { (value) -> State>> in value.traverse(transform).map { $0.traverse(f.identity) }.mapT { $0.joined() } @@ -916,148 +513,82 @@ public extension State { - public extension Writer { - - - - - func flatMapTT (_ transform: (Input) -> Writer>>) -> Writer>> where ParameterType == Array> { return flatMapT { (value) -> Writer>> in value.traverse(transform).map { $0.traverse(f.identity) }.mapT { $0.flatMap(f.identity) } } } - - - - func flatMapTT (_ transform: (Input) -> Writer>>) -> Writer>> where ParameterType == Array> { return flatMapT { (value) -> Writer>> in value.traverse(transform).map { $0.traverse(f.identity) }.mapT { $0.joined() } } } - - - - - func flatMapTT (_ transform: (Input) -> Writer>>) -> Writer>> where ParameterType == Array> { - return flatMapT { (value) -> Writer>> in + func flatMapTT (_ transform: (Input) -> Writer>>) -> Writer>> where ParameterType == Array> { + return flatMapT { (value) -> Writer>> in value.traverse(transform).map { $0.traverse(f.identity) }.mapT { $0.joined() } } } - - - - func flatMapTT (_ transform: (Input) -> Writer>>) -> Writer>> where ParameterType == Array> { return flatMapT { (value) -> Writer>> in value.traverse(transform).map { $0.traverse(f.identity) }.mapT { $0.joined() } } } - - - - func flatMapTT (_ transform: (Input) -> Writer>>) -> Writer>> where ParameterType == Optional> { return flatMapT { (value) -> Writer>> in value.traverse(transform).map { $0.traverse(f.identity) }.mapT { $0.flatMap(f.identity) } } } - - - - func flatMapTT (_ transform: (Input) -> Writer>>) -> Writer>> where ParameterType == Optional> { return flatMapT { (value) -> Writer>> in value.traverse(transform).map { $0.traverse(f.identity) }.mapT { $0.joined() } } } - - - - - func flatMapTT (_ transform: (Input) -> Writer>>) -> Writer>> where ParameterType == Optional> { - return flatMapT { (value) -> Writer>> in + func flatMapTT (_ transform: (Input) -> Writer>>) -> Writer>> where ParameterType == Optional> { + return flatMapT { (value) -> Writer>> in value.traverse(transform).map { $0.traverse(f.identity) }.mapT { $0.joined() } } } - - - - func flatMapTT (_ transform: (Input) -> Writer>>) -> Writer>> where ParameterType == Optional> { return flatMapT { (value) -> Writer>> in value.traverse(transform).map { $0.traverse(f.identity) }.mapT { $0.joined() } } } - - - - - func flatMapTT (_ transform: (Input) -> Writer>>) -> Writer>> where ParameterType == Result> { - return flatMapT { (value) -> Writer>> in + func flatMapTT (_ transform: (Input) -> Writer,Secondary2>>) -> Writer,Secondary2>> where ParameterType == Result,Secondary2> { + return flatMapT { (value) -> Writer,Secondary2>> in value.traverse(transform).map { $0.traverse(f.identity) }.mapT { $0.flatMap(f.identity) } } } - - - - - func flatMapTT (_ transform: (Input) -> Writer>>) -> Writer>> where ParameterType == Result> { - return flatMapT { (value) -> Writer>> in + func flatMapTT (_ transform: (Input) -> Writer,Secondary2>>) -> Writer,Secondary2>> where ParameterType == Result,Secondary2> { + return flatMapT { (value) -> Writer,Secondary2>> in value.traverse(transform).map { $0.traverse(f.identity) }.mapT { $0.joined() } } } - - - - - func flatMapTT (_ transform: (Input) -> Writer>>) -> Writer>> where ParameterType == Result> { - return flatMapT { (value) -> Writer>> in + func flatMapTT (_ transform: (Input) -> Writer,Secondary2>>) -> Writer,Secondary2>> where ParameterType == Result,Secondary2> { + return flatMapT { (value) -> Writer,Secondary2>> in value.traverse(transform).map { $0.traverse(f.identity) }.mapT { $0.joined() } } } - - - - - func flatMapTT (_ transform: (Input) -> Writer>>) -> Writer>> where ParameterType == Result> { - return flatMapT { (value) -> Writer>> in + func flatMapTT (_ transform: (Input) -> Writer,Secondary2>>) -> Writer,Secondary2>> where ParameterType == Result,Secondary2> { + return flatMapT { (value) -> Writer,Secondary2>> in value.traverse(transform).map { $0.traverse(f.identity) }.mapT { $0.joined() } } } - - - - func flatMapTT (_ transform: (Input) -> Writer>>) -> Writer>> where ParameterType == Writer> { return flatMapT { (value) -> Writer>> in value.traverse(transform).map { $0.traverse(f.identity) }.mapT { $0.flatMap(f.identity) } } } - - - - func flatMapTT (_ transform: (Input) -> Writer>>) -> Writer>> where ParameterType == Writer> { return flatMapT { (value) -> Writer>> in value.traverse(transform).map { $0.traverse(f.identity) }.mapT { $0.joined() } } } - - - - - func flatMapTT (_ transform: (Input) -> Writer>>) -> Writer>> where ParameterType == Writer> { - return flatMapT { (value) -> Writer>> in + func flatMapTT (_ transform: (Input) -> Writer>>) -> Writer>> where ParameterType == Writer> { + return flatMapT { (value) -> Writer>> in value.traverse(transform).map { $0.traverse(f.identity) }.mapT { $0.joined() } } } - - - - func flatMapTT (_ transform: (Input) -> Writer>>) -> Writer>> where ParameterType == Writer> { return flatMapT { (value) -> Writer>> in value.traverse(transform).map { $0.traverse(f.identity) }.mapT { $0.joined() } diff --git a/Sources/FunctionalKit/Optional.swift b/Sources/FunctionalKit/Optional.swift index 0e5b5e9..c092235 100644 --- a/Sources/FunctionalKit/Optional.swift +++ b/Sources/FunctionalKit/Optional.swift @@ -167,7 +167,7 @@ public extension Optional{ } } - func traverse (_ transform: (ParameterType) -> Result) -> Result> { + func traverse (_ transform: (ParameterType) -> Result) -> Result,F> { switch self { case let value?: return Result.pure(Optional.some) <*> transform(value) @@ -222,7 +222,7 @@ public extension Optional{ } } - func toResult (getError: @autoclosure () -> E) -> Result where E: Error { + func toResult (getError: @autoclosure () -> E) -> Result where E: Error { switch self { case let value?: return .success(value) diff --git a/Sources/FunctionalKit/Prism.swift b/Sources/FunctionalKit/Prism.swift index ad31389..20c19fd 100644 --- a/Sources/FunctionalKit/Prism.swift +++ b/Sources/FunctionalKit/Prism.swift @@ -92,7 +92,7 @@ extension Result { return iso.coproduct >>> Coproduct.prism.left } - public static var success: Prism { + public static var success: Prism { return iso.coproduct >>> Coproduct.prism.right } } diff --git a/Sources/FunctionalKit/ReaderTransformer.generated.swift b/Sources/FunctionalKit/ReaderTransformer.generated.swift index 666b0f0..131294c 100644 --- a/Sources/FunctionalKit/ReaderTransformer.generated.swift +++ b/Sources/FunctionalKit/ReaderTransformer.generated.swift @@ -3,1646 +3,885 @@ - - - - - - - - public extension Reader { - - - func flatMapT (_ transform: @escaping (Input) -> Reader>) -> Reader> where ParameterType == Array { return Reader>.init { e in self.run(e).flatMap { transform($0).run(e) } } } - - - func flatMapTT (_ transform: @escaping (Input) -> Reader>>) -> Reader>> where ParameterType == Array> { return Reader>>.init { e in self.run(e).flatMapT { transform($0).run(e) } } } - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Array>> { + func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Array>> { return Reader>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Array>> { + func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Array>> { return Reader>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Array>> { - return Reader>>>.init { e in + func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Array>> { + return Reader>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Array>> { + func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Array>> { return Reader>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - func flatMapTT (_ transform: @escaping (Input) -> Reader>>) -> Reader>> where ParameterType == Array> { return Reader>>.init { e in self.run(e).flatMapT { transform($0).run(e) } } } - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Array>> { + func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Array>> { return Reader>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Array>> { + func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Array>> { return Reader>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Array>> { - return Reader>>>.init { e in + func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Array>> { + return Reader>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Array>> { + func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Array>> { return Reader>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - func flatMapTT (_ transform: @escaping (Input) -> Reader>>) -> Reader>> where ParameterType == Array> { - return Reader>>.init { e in + func flatMapTT (_ transform: @escaping (Input) -> Reader>>) -> Reader>> where ParameterType == Array> { + return Reader>>.init { e in self.run(e).flatMapT { transform($0).run(e) } } } - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Array>> { - return Reader>>>.init { e in + func flatMapTTT (_ transform: @escaping (Input) -> Reader,Secondary2>>>) -> Reader,Secondary2>>> where ParameterType == Array,Secondary2>> { + return Reader,Secondary2>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Array>> { - return Reader>>>.init { e in + func flatMapTTT (_ transform: @escaping (Input) -> Reader,Secondary2>>>) -> Reader,Secondary2>>> where ParameterType == Array,Secondary2>> { + return Reader,Secondary2>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Array>> { - return Reader>>>.init { e in + func flatMapTTT (_ transform: @escaping (Input) -> Reader,Secondary2>>>) -> Reader,Secondary2>>> where ParameterType == Array,Secondary2>> { + return Reader,Secondary2>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Array>> { - return Reader>>>.init { e in + func flatMapTTT (_ transform: @escaping (Input) -> Reader,Secondary2>>>) -> Reader,Secondary2>>> where ParameterType == Array,Secondary2>> { + return Reader,Secondary2>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - func flatMapTT (_ transform: @escaping (Input) -> Reader>>) -> Reader>> where ParameterType == Array> { return Reader>>.init { e in self.run(e).flatMapT { transform($0).run(e) } } } - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Array>> { + func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Array>> { return Reader>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Array>> { + func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Array>> { return Reader>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Array>> { - return Reader>>>.init { e in + func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Array>> { + return Reader>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Array>> { + func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Array>> { return Reader>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - func flatMapT (_ transform: @escaping (Input) -> Reader>) -> Reader> where ParameterType == Effect { return Reader>.init { e in self.run(e).flatMap { transform($0).run(e) } } } - - - func flatMapTT (_ transform: @escaping (Input) -> Reader>>) -> Reader>> where ParameterType == Effect> { return Reader>>.init { e in self.run(e).flatMapT { transform($0).run(e) } } } - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Effect>> { + func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Effect>> { return Reader>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Effect>> { + func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Effect>> { return Reader>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Effect>> { - return Reader>>>.init { e in + func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Effect>> { + return Reader>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Effect>> { + func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Effect>> { return Reader>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - func flatMapTT (_ transform: @escaping (Input) -> Reader>>) -> Reader>> where ParameterType == Effect> { return Reader>>.init { e in self.run(e).flatMapT { transform($0).run(e) } } } - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Effect>> { + func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Effect>> { return Reader>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Effect>> { + func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Effect>> { return Reader>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Effect>> { - return Reader>>>.init { e in + func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Effect>> { + return Reader>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Effect>> { + func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Effect>> { return Reader>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - func flatMapTT (_ transform: @escaping (Input) -> Reader>>) -> Reader>> where ParameterType == Effect> { - return Reader>>.init { e in + func flatMapTT (_ transform: @escaping (Input) -> Reader>>) -> Reader>> where ParameterType == Effect> { + return Reader>>.init { e in self.run(e).flatMapT { transform($0).run(e) } } } - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Effect>> { - return Reader>>>.init { e in + func flatMapTTT (_ transform: @escaping (Input) -> Reader,Secondary2>>>) -> Reader,Secondary2>>> where ParameterType == Effect,Secondary2>> { + return Reader,Secondary2>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Effect>> { - return Reader>>>.init { e in + func flatMapTTT (_ transform: @escaping (Input) -> Reader,Secondary2>>>) -> Reader,Secondary2>>> where ParameterType == Effect,Secondary2>> { + return Reader,Secondary2>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Effect>> { - return Reader>>>.init { e in + func flatMapTTT (_ transform: @escaping (Input) -> Reader,Secondary2>>>) -> Reader,Secondary2>>> where ParameterType == Effect,Secondary2>> { + return Reader,Secondary2>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Effect>> { - return Reader>>>.init { e in + func flatMapTTT (_ transform: @escaping (Input) -> Reader,Secondary2>>>) -> Reader,Secondary2>>> where ParameterType == Effect,Secondary2>> { + return Reader,Secondary2>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - func flatMapTT (_ transform: @escaping (Input) -> Reader>>) -> Reader>> where ParameterType == Effect> { return Reader>>.init { e in self.run(e).flatMapT { transform($0).run(e) } } } - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Effect>> { + func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Effect>> { return Reader>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Effect>> { + func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Effect>> { return Reader>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Effect>> { - return Reader>>>.init { e in + func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Effect>> { + return Reader>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Effect>> { + func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Effect>> { return Reader>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - func flatMapT (_ transform: @escaping (Input) -> Reader>) -> Reader> where ParameterType == Future { return Reader>.init { e in self.run(e).flatMap { transform($0).run(e) } } } - - - func flatMapTT (_ transform: @escaping (Input) -> Reader>>) -> Reader>> where ParameterType == Future> { return Reader>>.init { e in self.run(e).flatMapT { transform($0).run(e) } } } - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Future>> { + func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Future>> { return Reader>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Future>> { + func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Future>> { return Reader>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Future>> { - return Reader>>>.init { e in + func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Future>> { + return Reader>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Future>> { + func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Future>> { return Reader>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - func flatMapTT (_ transform: @escaping (Input) -> Reader>>) -> Reader>> where ParameterType == Future> { return Reader>>.init { e in self.run(e).flatMapT { transform($0).run(e) } } } - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Future>> { + func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Future>> { return Reader>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Future>> { + func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Future>> { return Reader>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Future>> { - return Reader>>>.init { e in + func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Future>> { + return Reader>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Future>> { + func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Future>> { return Reader>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - func flatMapTT (_ transform: @escaping (Input) -> Reader>>) -> Reader>> where ParameterType == Future> { - return Reader>>.init { e in + func flatMapTT (_ transform: @escaping (Input) -> Reader>>) -> Reader>> where ParameterType == Future> { + return Reader>>.init { e in self.run(e).flatMapT { transform($0).run(e) } } } - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Future>> { - return Reader>>>.init { e in + func flatMapTTT (_ transform: @escaping (Input) -> Reader,Secondary2>>>) -> Reader,Secondary2>>> where ParameterType == Future,Secondary2>> { + return Reader,Secondary2>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Future>> { - return Reader>>>.init { e in + func flatMapTTT (_ transform: @escaping (Input) -> Reader,Secondary2>>>) -> Reader,Secondary2>>> where ParameterType == Future,Secondary2>> { + return Reader,Secondary2>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Future>> { - return Reader>>>.init { e in + func flatMapTTT (_ transform: @escaping (Input) -> Reader,Secondary2>>>) -> Reader,Secondary2>>> where ParameterType == Future,Secondary2>> { + return Reader,Secondary2>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Future>> { - return Reader>>>.init { e in + func flatMapTTT (_ transform: @escaping (Input) -> Reader,Secondary2>>>) -> Reader,Secondary2>>> where ParameterType == Future,Secondary2>> { + return Reader,Secondary2>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - func flatMapTT (_ transform: @escaping (Input) -> Reader>>) -> Reader>> where ParameterType == Future> { return Reader>>.init { e in self.run(e).flatMapT { transform($0).run(e) } } } - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Future>> { + func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Future>> { return Reader>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Future>> { + func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Future>> { return Reader>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Future>> { - return Reader>>>.init { e in + func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Future>> { + return Reader>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Future>> { + func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Future>> { return Reader>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - func flatMapT (_ transform: @escaping (Input) -> Reader>) -> Reader> where ParameterType == Optional { return Reader>.init { e in self.run(e).flatMap { transform($0).run(e) } } } - - - func flatMapTT (_ transform: @escaping (Input) -> Reader>>) -> Reader>> where ParameterType == Optional> { return Reader>>.init { e in self.run(e).flatMapT { transform($0).run(e) } } } - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Optional>> { + func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Optional>> { return Reader>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Optional>> { + func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Optional>> { return Reader>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Optional>> { - return Reader>>>.init { e in + func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Optional>> { + return Reader>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Optional>> { + func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Optional>> { return Reader>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - func flatMapTT (_ transform: @escaping (Input) -> Reader>>) -> Reader>> where ParameterType == Optional> { return Reader>>.init { e in self.run(e).flatMapT { transform($0).run(e) } } } - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Optional>> { + func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Optional>> { return Reader>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Optional>> { + func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Optional>> { return Reader>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Optional>> { - return Reader>>>.init { e in + func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Optional>> { + return Reader>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Optional>> { + func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Optional>> { return Reader>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - func flatMapTT (_ transform: @escaping (Input) -> Reader>>) -> Reader>> where ParameterType == Optional> { - return Reader>>.init { e in + func flatMapTT (_ transform: @escaping (Input) -> Reader>>) -> Reader>> where ParameterType == Optional> { + return Reader>>.init { e in self.run(e).flatMapT { transform($0).run(e) } } } - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Optional>> { - return Reader>>>.init { e in + func flatMapTTT (_ transform: @escaping (Input) -> Reader,Secondary2>>>) -> Reader,Secondary2>>> where ParameterType == Optional,Secondary2>> { + return Reader,Secondary2>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Optional>> { - return Reader>>>.init { e in + func flatMapTTT (_ transform: @escaping (Input) -> Reader,Secondary2>>>) -> Reader,Secondary2>>> where ParameterType == Optional,Secondary2>> { + return Reader,Secondary2>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Optional>> { - return Reader>>>.init { e in + func flatMapTTT (_ transform: @escaping (Input) -> Reader,Secondary2>>>) -> Reader,Secondary2>>> where ParameterType == Optional,Secondary2>> { + return Reader,Secondary2>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Optional>> { - return Reader>>>.init { e in + func flatMapTTT (_ transform: @escaping (Input) -> Reader,Secondary2>>>) -> Reader,Secondary2>>> where ParameterType == Optional,Secondary2>> { + return Reader,Secondary2>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - func flatMapTT (_ transform: @escaping (Input) -> Reader>>) -> Reader>> where ParameterType == Optional> { return Reader>>.init { e in self.run(e).flatMapT { transform($0).run(e) } } } - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Optional>> { + func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Optional>> { return Reader>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Optional>> { + func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Optional>> { return Reader>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Optional>> { - return Reader>>>.init { e in + func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Optional>> { + return Reader>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Optional>> { + func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Optional>> { return Reader>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - func flatMapT (_ transform: @escaping (Input) -> Reader>) -> Reader> where ParameterType == Reader { - return Reader>.init { e in + func flatMapT (_ transform: @escaping (Input) -> Reader>) -> Reader> where ParameterType == Reader { + return Reader>.init { e in self.run(e).flatMap { transform($0).run(e) } } } - - - func flatMapTT (_ transform: @escaping (Input) -> Reader>>) -> Reader>> where ParameterType == Reader> { return Reader>>.init { e in self.run(e).flatMapT { transform($0).run(e) } } } - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Reader>> { + func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Reader>> { return Reader>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Reader>> { + func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Reader>> { return Reader>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Reader>> { - return Reader>>>.init { e in + func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Reader>> { + return Reader>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Reader>> { + func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Reader>> { return Reader>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - func flatMapTT (_ transform: @escaping (Input) -> Reader>>) -> Reader>> where ParameterType == Reader> { return Reader>>.init { e in self.run(e).flatMapT { transform($0).run(e) } } } - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Reader>> { + func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Reader>> { return Reader>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Reader>> { + func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Reader>> { return Reader>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Reader>> { - return Reader>>>.init { e in + func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Reader>> { + return Reader>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Reader>> { + func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Reader>> { return Reader>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - func flatMapTT (_ transform: @escaping (Input) -> Reader>>) -> Reader>> where ParameterType == Reader> { - return Reader>>.init { e in + func flatMapTT (_ transform: @escaping (Input) -> Reader>>) -> Reader>> where ParameterType == Reader> { + return Reader>>.init { e in self.run(e).flatMapT { transform($0).run(e) } } } - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Reader>> { - return Reader>>>.init { e in + func flatMapTTT (_ transform: @escaping (Input) -> Reader,Secondary2>>>) -> Reader,Secondary2>>> where ParameterType == Reader,Secondary2>> { + return Reader,Secondary2>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Reader>> { - return Reader>>>.init { e in + func flatMapTTT (_ transform: @escaping (Input) -> Reader,Secondary2>>>) -> Reader,Secondary2>>> where ParameterType == Reader,Secondary2>> { + return Reader,Secondary2>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Reader>> { - return Reader>>>.init { e in + func flatMapTTT (_ transform: @escaping (Input) -> Reader,Secondary2>>>) -> Reader,Secondary2>>> where ParameterType == Reader,Secondary2>> { + return Reader,Secondary2>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Reader>> { - return Reader>>>.init { e in + func flatMapTTT (_ transform: @escaping (Input) -> Reader,Secondary2>>>) -> Reader,Secondary2>>> where ParameterType == Reader,Secondary2>> { + return Reader,Secondary2>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - func flatMapTT (_ transform: @escaping (Input) -> Reader>>) -> Reader>> where ParameterType == Reader> { return Reader>>.init { e in self.run(e).flatMapT { transform($0).run(e) } } } - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Reader>> { + func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Reader>> { return Reader>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Reader>> { + func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Reader>> { return Reader>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Reader>> { - return Reader>>>.init { e in + func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Reader>> { + return Reader>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Reader>> { + func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Reader>> { return Reader>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - func flatMapT (_ transform: @escaping (Input) -> Reader>) -> Reader> where ParameterType == Result { - return Reader>.init { e in + func flatMapT (_ transform: @escaping (Input) -> Reader>) -> Reader> where ParameterType == Result { + return Reader>.init { e in self.run(e).flatMap { transform($0).run(e) } } } - - - - func flatMapTT (_ transform: @escaping (Input) -> Reader>>) -> Reader>> where ParameterType == Result> { - return Reader>>.init { e in + func flatMapTT (_ transform: @escaping (Input) -> Reader,Secondary1>>) -> Reader,Secondary1>> where ParameterType == Result,Secondary1> { + return Reader,Secondary1>>.init { e in self.run(e).flatMapT { transform($0).run(e) } } } - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Result>> { - return Reader>>>.init { e in + func flatMapTTT (_ transform: @escaping (Input) -> Reader>,Secondary1>>) -> Reader>,Secondary1>> where ParameterType == Result>,Secondary1> { + return Reader>,Secondary1>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Result>> { - return Reader>>>.init { e in + func flatMapTTT (_ transform: @escaping (Input) -> Reader>,Secondary1>>) -> Reader>,Secondary1>> where ParameterType == Result>,Secondary1> { + return Reader>,Secondary1>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Result>> { - return Reader>>>.init { e in + func flatMapTTT (_ transform: @escaping (Input) -> Reader>,Secondary1>>) -> Reader>,Secondary1>> where ParameterType == Result>,Secondary1> { + return Reader>,Secondary1>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Result>> { - return Reader>>>.init { e in + func flatMapTTT (_ transform: @escaping (Input) -> Reader>,Secondary1>>) -> Reader>,Secondary1>> where ParameterType == Result>,Secondary1> { + return Reader>,Secondary1>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - func flatMapTT (_ transform: @escaping (Input) -> Reader>>) -> Reader>> where ParameterType == Result> { - return Reader>>.init { e in + func flatMapTT (_ transform: @escaping (Input) -> Reader,Secondary1>>) -> Reader,Secondary1>> where ParameterType == Result,Secondary1> { + return Reader,Secondary1>>.init { e in self.run(e).flatMapT { transform($0).run(e) } } } - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Result>> { - return Reader>>>.init { e in + func flatMapTTT (_ transform: @escaping (Input) -> Reader>,Secondary1>>) -> Reader>,Secondary1>> where ParameterType == Result>,Secondary1> { + return Reader>,Secondary1>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Result>> { - return Reader>>>.init { e in + func flatMapTTT (_ transform: @escaping (Input) -> Reader>,Secondary1>>) -> Reader>,Secondary1>> where ParameterType == Result>,Secondary1> { + return Reader>,Secondary1>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Result>> { - return Reader>>>.init { e in + func flatMapTTT (_ transform: @escaping (Input) -> Reader>,Secondary1>>) -> Reader>,Secondary1>> where ParameterType == Result>,Secondary1> { + return Reader>,Secondary1>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Result>> { - return Reader>>>.init { e in + func flatMapTTT (_ transform: @escaping (Input) -> Reader>,Secondary1>>) -> Reader>,Secondary1>> where ParameterType == Result>,Secondary1> { + return Reader>,Secondary1>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - func flatMapTT (_ transform: @escaping (Input) -> Reader>>) -> Reader>> where ParameterType == Result> { - return Reader>>.init { e in + func flatMapTT (_ transform: @escaping (Input) -> Reader,Secondary1>>) -> Reader,Secondary1>> where ParameterType == Result,Secondary1> { + return Reader,Secondary1>>.init { e in self.run(e).flatMapT { transform($0).run(e) } } } - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Result>> { - return Reader>>>.init { e in + func flatMapTTT (_ transform: @escaping (Input) -> Reader,Secondary2>,Secondary1>>) -> Reader,Secondary2>,Secondary1>> where ParameterType == Result,Secondary2>,Secondary1> { + return Reader,Secondary2>,Secondary1>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Result>> { - return Reader>>>.init { e in + func flatMapTTT (_ transform: @escaping (Input) -> Reader,Secondary2>,Secondary1>>) -> Reader,Secondary2>,Secondary1>> where ParameterType == Result,Secondary2>,Secondary1> { + return Reader,Secondary2>,Secondary1>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Result>> { - return Reader>>>.init { e in + func flatMapTTT (_ transform: @escaping (Input) -> Reader,Secondary2>,Secondary1>>) -> Reader,Secondary2>,Secondary1>> where ParameterType == Result,Secondary2>,Secondary1> { + return Reader,Secondary2>,Secondary1>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Result>> { - return Reader>>>.init { e in + func flatMapTTT (_ transform: @escaping (Input) -> Reader,Secondary2>,Secondary1>>) -> Reader,Secondary2>,Secondary1>> where ParameterType == Result,Secondary2>,Secondary1> { + return Reader,Secondary2>,Secondary1>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - func flatMapTT (_ transform: @escaping (Input) -> Reader>>) -> Reader>> where ParameterType == Result> { - return Reader>>.init { e in + func flatMapTT (_ transform: @escaping (Input) -> Reader,Secondary1>>) -> Reader,Secondary1>> where ParameterType == Result,Secondary1> { + return Reader,Secondary1>>.init { e in self.run(e).flatMapT { transform($0).run(e) } } } - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Result>> { - return Reader>>>.init { e in + func flatMapTTT (_ transform: @escaping (Input) -> Reader>,Secondary1>>) -> Reader>,Secondary1>> where ParameterType == Result>,Secondary1> { + return Reader>,Secondary1>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Result>> { - return Reader>>>.init { e in + func flatMapTTT (_ transform: @escaping (Input) -> Reader>,Secondary1>>) -> Reader>,Secondary1>> where ParameterType == Result>,Secondary1> { + return Reader>,Secondary1>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Result>> { - return Reader>>>.init { e in + func flatMapTTT (_ transform: @escaping (Input) -> Reader>,Secondary1>>) -> Reader>,Secondary1>> where ParameterType == Result>,Secondary1> { + return Reader>,Secondary1>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Result>> { - return Reader>>>.init { e in + func flatMapTTT (_ transform: @escaping (Input) -> Reader>,Secondary1>>) -> Reader>,Secondary1>> where ParameterType == Result>,Secondary1> { + return Reader>,Secondary1>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - func flatMapT (_ transform: @escaping (Input) -> Reader>) -> Reader> where ParameterType == State { - return Reader>.init { e in + func flatMapT (_ transform: @escaping (Input) -> Reader>) -> Reader> where ParameterType == State { + return Reader>.init { e in self.run(e).flatMap { transform($0).run(e) } } } - - - func flatMapTT (_ transform: @escaping (Input) -> Reader>>) -> Reader>> where ParameterType == State> { return Reader>>.init { e in self.run(e).flatMapT { transform($0).run(e) } } } - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == State>> { + func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == State>> { return Reader>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == State>> { + func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == State>> { return Reader>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == State>> { - return Reader>>>.init { e in + func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == State>> { + return Reader>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == State>> { + func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == State>> { return Reader>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - func flatMapTT (_ transform: @escaping (Input) -> Reader>>) -> Reader>> where ParameterType == State> { return Reader>>.init { e in self.run(e).flatMapT { transform($0).run(e) } } } - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == State>> { + func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == State>> { return Reader>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == State>> { + func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == State>> { return Reader>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == State>> { - return Reader>>>.init { e in + func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == State>> { + return Reader>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == State>> { + func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == State>> { return Reader>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - func flatMapTT (_ transform: @escaping (Input) -> Reader>>) -> Reader>> where ParameterType == State> { - return Reader>>.init { e in + func flatMapTT (_ transform: @escaping (Input) -> Reader>>) -> Reader>> where ParameterType == State> { + return Reader>>.init { e in self.run(e).flatMapT { transform($0).run(e) } } } - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == State>> { - return Reader>>>.init { e in + func flatMapTTT (_ transform: @escaping (Input) -> Reader,Secondary2>>>) -> Reader,Secondary2>>> where ParameterType == State,Secondary2>> { + return Reader,Secondary2>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == State>> { - return Reader>>>.init { e in + func flatMapTTT (_ transform: @escaping (Input) -> Reader,Secondary2>>>) -> Reader,Secondary2>>> where ParameterType == State,Secondary2>> { + return Reader,Secondary2>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == State>> { - return Reader>>>.init { e in + func flatMapTTT (_ transform: @escaping (Input) -> Reader,Secondary2>>>) -> Reader,Secondary2>>> where ParameterType == State,Secondary2>> { + return Reader,Secondary2>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == State>> { - return Reader>>>.init { e in + func flatMapTTT (_ transform: @escaping (Input) -> Reader,Secondary2>>>) -> Reader,Secondary2>>> where ParameterType == State,Secondary2>> { + return Reader,Secondary2>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - func flatMapTT (_ transform: @escaping (Input) -> Reader>>) -> Reader>> where ParameterType == State> { return Reader>>.init { e in self.run(e).flatMapT { transform($0).run(e) } } } - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == State>> { + func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == State>> { return Reader>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == State>> { + func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == State>> { return Reader>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == State>> { - return Reader>>>.init { e in + func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == State>> { + return Reader>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == State>> { + func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == State>> { return Reader>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - func flatMapT (_ transform: @escaping (Input) -> Reader>) -> Reader> where ParameterType == Writer { - return Reader>.init { e in + func flatMapT (_ transform: @escaping (Input) -> Reader>) -> Reader> where ParameterType == Writer { + return Reader>.init { e in self.run(e).flatMap { transform($0).run(e) } } } - - - func flatMapTT (_ transform: @escaping (Input) -> Reader>>) -> Reader>> where ParameterType == Writer> { return Reader>>.init { e in self.run(e).flatMapT { transform($0).run(e) } } } - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Writer>> { + func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Writer>> { return Reader>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Writer>> { + func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Writer>> { return Reader>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Writer>> { - return Reader>>>.init { e in + func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Writer>> { + return Reader>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Writer>> { + func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Writer>> { return Reader>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - func flatMapTT (_ transform: @escaping (Input) -> Reader>>) -> Reader>> where ParameterType == Writer> { return Reader>>.init { e in self.run(e).flatMapT { transform($0).run(e) } } } - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Writer>> { + func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Writer>> { return Reader>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Writer>> { + func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Writer>> { return Reader>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Writer>> { - return Reader>>>.init { e in + func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Writer>> { + return Reader>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Writer>> { + func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Writer>> { return Reader>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - func flatMapTT (_ transform: @escaping (Input) -> Reader>>) -> Reader>> where ParameterType == Writer> { - return Reader>>.init { e in + func flatMapTT (_ transform: @escaping (Input) -> Reader>>) -> Reader>> where ParameterType == Writer> { + return Reader>>.init { e in self.run(e).flatMapT { transform($0).run(e) } } } - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Writer>> { - return Reader>>>.init { e in + func flatMapTTT (_ transform: @escaping (Input) -> Reader,Secondary2>>>) -> Reader,Secondary2>>> where ParameterType == Writer,Secondary2>> { + return Reader,Secondary2>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Writer>> { - return Reader>>>.init { e in + func flatMapTTT (_ transform: @escaping (Input) -> Reader,Secondary2>>>) -> Reader,Secondary2>>> where ParameterType == Writer,Secondary2>> { + return Reader,Secondary2>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Writer>> { - return Reader>>>.init { e in + func flatMapTTT (_ transform: @escaping (Input) -> Reader,Secondary2>>>) -> Reader,Secondary2>>> where ParameterType == Writer,Secondary2>> { + return Reader,Secondary2>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Writer>> { - return Reader>>>.init { e in + func flatMapTTT (_ transform: @escaping (Input) -> Reader,Secondary2>>>) -> Reader,Secondary2>>> where ParameterType == Writer,Secondary2>> { + return Reader,Secondary2>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - func flatMapTT (_ transform: @escaping (Input) -> Reader>>) -> Reader>> where ParameterType == Writer> { return Reader>>.init { e in self.run(e).flatMapT { transform($0).run(e) } } } - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Writer>> { + func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Writer>> { return Reader>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Writer>> { + func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Writer>> { return Reader>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Writer>> { - return Reader>>>.init { e in + func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Writer>> { + return Reader>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - - - - - - func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Writer>> { + func flatMapTTT (_ transform: @escaping (Input) -> Reader>>>) -> Reader>>> where ParameterType == Writer>> { return Reader>>>.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - } diff --git a/Sources/FunctionalKit/Result.swift b/Sources/FunctionalKit/Result.swift index d0a385e..6fa5f70 100644 --- a/Sources/FunctionalKit/Result.swift +++ b/Sources/FunctionalKit/Result.swift @@ -5,6 +5,7 @@ import Abstract // sourcery: functor // sourcery: secondaryParameter = "Failure" +// sourcery: secondaryParameterOnRight = true // sourcery: monad // sourcery: traversable // sourcery: testFunctor @@ -12,20 +13,9 @@ import Abstract // sourcery: testMonad // sourcery: testConstruct = "success(x)" // sourcery: testSecondaryParameter -public enum Result where Failure: Error { - case success(Parameter) - case failure(Failure) +extension Result { - public func run() throws -> Parameter { - switch self { - case .success(let value): - return value - case .failure(let error): - throw error - } - } - - public func fold (onSuccess: (Parameter) -> A, onFailure: (Failure) -> A) -> A { + public func fold (onSuccess: (Success) -> A, onFailure: (Failure) -> A) -> A { switch self { case .success(let value): return onSuccess(value) @@ -35,28 +25,26 @@ public enum Result where Failure: Error { } } -extension Result: Equatable where Failure: Equatable, Parameter: Equatable {} - extension Result: CoproductType { - public typealias LeftType = Failure - public typealias RightType = Parameter + public typealias RightType = Failure + public typealias LeftType = Success - public func fold(onLeft: (Failure) -> T, onRight: (Parameter) -> T) -> T { - return fold(onSuccess: onRight, onFailure: onLeft) + public func fold(onLeft: (Success) -> T, onRight: (Failure) -> T) -> T { + return fold(onSuccess: onLeft, onFailure: onRight) } - public static func from(coproduct: Coproduct) -> Result { + public static func from(coproduct: Coproduct) -> Result { switch coproduct { - case let .left(error): + case let .right(error): return .failure(error) - case let .right(value): + case let .left(value): return .success(value) } } } extension Result: TypeConstructor2 { - public typealias ParameterType = Parameter + public typealias ParameterType = Success public typealias SecondaryType = Failure } @@ -67,34 +55,16 @@ extension Result: PureConstructible { } public extension Result { - typealias Generic = Result where F: Error + typealias Generic = Result where F: Error } public extension Result { - func map (_ transform: (ParameterType) -> A) -> Result { - switch self { - case let .success(value): - return .success(transform(value)) - case let .failure(error): - return .failure(error) - } - } - - func mapError (_ transform: (Failure) -> A) -> Result { - switch self { - case let .success(value): - return .success(value) - case let .failure(error): - return .failure(transform(error)) - } - - } - static func lift (_ function: @escaping (ParameterType) -> A) -> (Result) -> Result { + static func lift (_ function: @escaping (ParameterType) -> A) -> (Result) -> Result { return { $0.map(function) } } - static func zip (_ first: Result, _ second: Result) -> Result,(A,B)> where Failure == InclusiveError, ParameterType == (A,B) { + static func zip (_ first: Result, _ second: Result) -> Result<(A,B),InclusiveError> where Failure == InclusiveError, ParameterType == (A,B) { switch (first, second) { case let (.success(leftValue), .success(rightValue)): return .success((leftValue,rightValue)) @@ -110,53 +80,53 @@ public extension Result { } } - static func zipMerged (_ first: Result, _ second: Result) -> Result where Failure: Semigroup { + static func zipMerged (_ first: Result, _ second: Result) -> Result<(A,B), Failure> where Failure: Semigroup { return Generic.zip(first, second).mapError { $0.toInclusive().merged() } } - func apply (_ transform: Result A>) -> Result { + func apply (_ transform: Result<(ParameterType) -> A, Failure>) -> Result { return Generic.zip(self, transform) .map { value, function in function(value) } .mapError { $0.toInclusive().left } } - func applyMerged (_ transform: Result A>) -> Result where Failure: Semigroup { - return Result A)>.zipMerged(self, transform) + func applyMerged (_ transform: Result<(ParameterType) -> A, Failure>) -> Result where Failure: Semigroup { + return Result<(Success, (Success) -> A), Failure>.zipMerged(self, transform) .map { value, function in function(value) } } - func call (_ value: Result) -> Result where ParameterType == (A) -> B { + func call (_ value: Result) -> Result where ParameterType == (A) -> B { return Generic.zip(self, value) .map { function, value in function(value) } .mapError { $0.toInclusive().left } } - func callMerged (_ value: Result) -> Result where ParameterType == (A) -> B, Failure: Semigroup { - return Result B, A)>.zipMerged(self, value) + func callMerged (_ value: Result) -> Result where ParameterType == (A) -> B, Failure: Semigroup { + return Result<((A) -> B, A), Failure>.zipMerged(self, value) .map { function, value in function(value) } } - static func <*> (lhs: Result A>, rhs: Result) -> Result { + static func <*> (lhs: Result<(ParameterType) -> A, Failure>, rhs: Result) -> Result { return lhs.call(rhs) } - static func <*> (lhs: Result A>, rhs: Result) -> Result where Failure: Semigroup { + static func <*> (lhs: Result<(ParameterType) -> A,Failure>, rhs: Result) -> Result where Failure: Semigroup { return lhs.callMerged(rhs) } - static func lift (_ function: @escaping (A, B) -> ParameterType) -> (Result, Result) -> Result { + static func lift (_ function: @escaping (A, B) -> ParameterType) -> (Result, Result) -> Result { return { ap1, ap2 in Generic.pure(f.curry(function)) <*> ap1 <*> ap2 } } - static func lift (_ function: @escaping (A, B, C) -> ParameterType) -> (Result, Result, Result) -> Result { + static func lift (_ function: @escaping (A, B, C) -> ParameterType) -> (Result, Result, Result) -> Result { return { ap1, ap2, ap3 in Generic.pure(f.curry(function)) <*> ap1 <*> ap2 <*> ap3 } } - func joined() -> Result where ParameterType == Result { + func joined() -> Result where ParameterType == Result { switch self { case let .success(value): return value @@ -165,11 +135,7 @@ public extension Result { } } - func flatMap (_ transform: (ParameterType) -> Result) -> Result { - return map(transform).joined() - } - - func traverse (_ transform: (ParameterType) -> Array) -> Array> { + func traverse (_ transform: (ParameterType) -> Array) -> Array> { switch self { case let .success(value): return Array.pure(Generic.success) <*> transform(value) @@ -178,7 +144,7 @@ public extension Result { } } - func traverse (_ transform: (ParameterType) -> Effect) -> Effect> { + func traverse (_ transform: (ParameterType) -> Effect) -> Effect> { switch self { case let .success(value): return Effect.pure(Generic.success) <*> transform(value) @@ -187,7 +153,7 @@ public extension Result { } } - func traverse (_ transform: (ParameterType) -> Future) -> Future> { + func traverse (_ transform: (ParameterType) -> Future) -> Future> { switch self { case let .success(value): return Future.pure(Generic.success) <*> transform(value) @@ -196,7 +162,7 @@ public extension Result { } } - func traverse (_ transform: (ParameterType) -> Optional) -> Optional> { + func traverse (_ transform: (ParameterType) -> Optional) -> Optional> { switch self { case let .success(value): return Optional.pure(Generic.success) <*> transform(value) @@ -205,7 +171,7 @@ public extension Result { } } - func traverse (_ transform: (ParameterType) -> Reader) -> Reader> { + func traverse (_ transform: (ParameterType) -> Reader) -> Reader> { switch self { case let .success(value): return Reader.pure(Generic.success) <*> transform(value) @@ -214,7 +180,7 @@ public extension Result { } } - func traverse (_ transform: (ParameterType) -> Result) -> Result> { + func traverse (_ transform: (ParameterType) -> Result) -> Result, F> { switch self { case let .success(value): return Generic.pure(Generic.success) <*> transform(value) @@ -223,7 +189,7 @@ public extension Result { } } - func traverse (_ transform: (ParameterType) -> State) -> State> { + func traverse (_ transform: (ParameterType) -> State) -> State> { switch self { case let .success(value): return State.pure(Generic.success) <*> transform(value) @@ -232,7 +198,7 @@ public extension Result { } } - func traverse (_ transform: (ParameterType) -> Writer) -> Writer> { + func traverse (_ transform: (ParameterType) -> Writer) -> Writer> { switch self { case let .success(value): return Writer.pure(Generic.success) <*> transform(value) @@ -259,7 +225,7 @@ public extension Result { } } - func getOr(_ fromFailure: (Failure) -> Parameter) -> Parameter { + func getOr(_ fromFailure: (Failure) -> Success) -> Success { return fold( onSuccess: f.identity, onFailure: fromFailure) @@ -274,7 +240,7 @@ public extension Result { } } - func filter(_ predicate: (Parameter) -> Bool, or onFalse: @autoclosure () -> Failure) -> Result { + func filter(_ predicate: (Success) -> Bool, or onFalse: @autoclosure () -> Failure) -> Result { return flatMap { if predicate($0) { return .success($0) @@ -296,7 +262,7 @@ public extension Result { } @discardableResult - func `do`(onSuccess: (Parameter) -> Void, onFailure: (Failure) -> Void) -> Result { + func `do`(onSuccess: (Success) -> Void, onFailure: (Failure) -> Void) -> Result { switch self { case let .success(value): onSuccess(value) @@ -307,7 +273,7 @@ public extension Result { return self } - func orNil() -> Result> { + func orNil() -> Result, Failure> { return self .map(Optional.init) .fallback(to: nil) @@ -319,21 +285,21 @@ public extension Result { onFailure: { _ in other() }) } - func extractT () -> Result where Parameter == Coreader { + func extractT () -> Result where Success == Coreader { return self.map { $0.extract } } - func mapExtend (_ transform: @escaping (E, P) -> A) -> Result> where Parameter == Coreader { + func mapExtend (_ transform: @escaping (E, P) -> A) -> Result, Failure> where Success == Coreader { return self.map { $0.extend(transform) } } - func mapExtract (_ transform: @escaping (P) -> A) -> Result> where Parameter == Coreader { + func mapExtract (_ transform: @escaping (P) -> A) -> Result, Failure> where Success == Coreader { return self.mapExtend { _, value in transform(value) } } - func flatMapExtend (_ transform: @escaping (E, P) -> Result) -> Result> where Parameter == Coreader { + func flatMapExtend (_ transform: @escaping (E, P) -> Result) -> Result, Failure> where Success == Coreader { return self.flatMap { old in return old.extend(transform).extract.map { new in old.map { _ in new } @@ -341,14 +307,14 @@ public extension Result { } } - func flatMapExtract (_ transform: @escaping (P) -> Result) -> Result> where Parameter == Coreader { + func flatMapExtract (_ transform: @escaping (P) -> Result) -> Result, Failure> where Success == Coreader { return self.flatMapExtend { _, value in transform(value) } } } extension First: Error where A: Error {} -extension Result: Magma where Failure: Magma, Parameter: Magma { +extension Result: Magma where Failure: Magma, Success: Magma { public static func <> (lhs: Result, rhs: Result) -> Result { switch (lhs, rhs) { case (.success(let lhsValue), .success(let rhsValue)): @@ -363,10 +329,10 @@ extension Result: Magma where Failure: Magma, Parameter: Magma { } } -extension Result: Semigroup where Failure: Semigroup, Parameter: Semigroup {} +extension Result: Semigroup where Failure: Semigroup, Success: Semigroup {} -extension Result: Monoid where Failure: Semigroup, Parameter: Monoid { - public static var empty: Result { +extension Result: Monoid where Failure: Semigroup, Success: Monoid { + public static var empty: Result { return .success(.empty) } } diff --git a/Sources/FunctionalKit/Writer.swift b/Sources/FunctionalKit/Writer.swift index d173961..76d01fc 100644 --- a/Sources/FunctionalKit/Writer.swift +++ b/Sources/FunctionalKit/Writer.swift @@ -122,7 +122,7 @@ public extension Writer { return Reader.pure(f.curry(Generic.init)) <*> Reader.pure(log) <*> transform(value) } - func traverse (_ transform: (ParameterType) -> Result) -> Result> { + func traverse (_ transform: (ParameterType) -> Result) -> Result,F> { return Result.pure(f.curry(Generic.init)) <*> Result.pure(log) <*> transform(value) } diff --git a/Templates/Sources/FunctorTransformers2.stencil b/Templates/Sources/FunctorTransformers2.stencil index 53c68e5..429bc41 100644 --- a/Templates/Sources/FunctorTransformers2.stencil +++ b/Templates/Sources/FunctorTransformers2.stencil @@ -1,34 +1,25 @@ {# GLOBAL MACROS #} - -{% macro getSecondaryParameter type level %}{% if type.annotations.secondaryParameter %}Secondary{{ level }},{% else %}{% endif %}{% endmacro %} - {% macro getMapName type %}{% if type|annotated:"customMap" %}{{ type.annotations.customMap }}{% else %}map{% endif %}{% endmacro %} - -{% macro getTypeName type parameter secondaryParameter %}{{ type.name }}<{{ secondaryParameter }}{{ parameter }}>{% endmacro %} - {% macro checkEscaping2 type1 type2 %}{% if type1.annotations.escapingHOF %}@escaping {% elif type2.annotations.escapingHOF %}@escaping {% endif %}{% endmacro %} +{% macro getComma type %}{% if type.annotations.secondaryParameter %},{% else %}{% endif %}{% endmacro %} +{# GENERIC PARAMETER #} +{% macro getDefinitionGenericParameter type %}{% if type.annotations.secondaryParameter %}Secondary{% else %}{% endif %}{% endmacro %} +{# INPUT TYPE CONSTRAINT #} +{% macro getInputConstraint type primary %}{% if type.annotations.secondaryParameter and type.annotations.secondaryParameterOnRight|annotated:"true" %}{{ type.name }}<{{ primary }}{% call getComma type %}{% call getDefinitionGenericParameter type %}>{% elif type.annotations.secondaryParameter %}{{ type.name }}<{% call getDefinitionGenericParameter type %}{% call getComma type %}{{ primary }}>{% else %}{{ type.name }}<{{ primary }}>{% endif %}{% endmacro %} +{# OUTPUT TYPE CONCRETE #} +{% macro getPrimaryGenericConcreteParameter type primary %}{% if type.annotations.secondaryParameter and type.annotations.secondaryParameterOnRight|annotated:"true" %}{{ type.name }}<{{ primary }}{% call getComma type %}{% call getDefinitionGenericParameter type %}>{% elif type.annotations.secondaryParameter %}{{ type.name }}<{% call getDefinitionGenericParameter type %}{% call getComma type %}{{ primary }}>{% else %}{{ type.name }}<{{ primary }}>{% endif %}{% endmacro %} +{% macro getOutputConcreteType type1 type2 primary %}{% if type1.annotations.secondaryParameter and type1.annotations.secondaryParameterOnRight|annotated:"true" %}{{ type1.name }}<{% call getPrimaryGenericConcreteParameter type2 primary %}{% call getComma type1 %}{{ type1.annotations.secondaryParameter }}>{% elif type1.annotations.secondaryParameter %}{{ type1.name }}<{{ type1.annotations.secondaryParameter }}{% call getComma type1 %}{% call getPrimaryGenericConcreteParameter type2 primary %}>{% else %}{{type1.name}}<{% call getPrimaryGenericConcreteParameter type2 primary %}>{% endif %}{% endmacro %} {# TRANSFORMERS #} - {% for type1 in types.all|annotated:"functor" %} - public extension {{ type1.name }} { - {% for type2 in types.all|annotated:"functor" %} - -{% set type2Secondary %}{% call getSecondaryParameter type2 "2" %}{% endset %} -{% set type2Constraint %}{% call getTypeName type2 "Input" type2Secondary %}{% endset %} -{% set type2Concrete %}{% call getTypeName type2 "Output" type2Secondary %}{% endset %} - -{% set type1Secondary %}{% if type1.annotations.secondaryParameter %}{{ type1.annotations.secondaryParameter }},{% else %}{% endif %}{% endset %} -{% set type1Concrete %}{% call getTypeName type1 type2Concrete type1Secondary %}{% endset %} - - func mapT <{{ type2Secondary }}Input,Output> (_ transform: {% call checkEscaping2 type1 type2 %}(Input) -> Output) -> {{ type1Concrete }} where ParameterType == {{ type2Constraint }} { +{% set genericSecondaryParameter %}{% call getDefinitionGenericParameter type2 %}{% call getComma type2 %}{% endset %} +{% set inputConstraint %}{% call getInputConstraint type2 "Input" %}{% endset %} +{% set outputType %}{% call getOutputConcreteType type1 type2 "Output" %}{% endset %} + func mapT <{{ genericSecondaryParameter }}Input,Output> (_ transform: {% call checkEscaping2 type1 type2 %}(Input) -> Output) -> {{ outputType }} where ParameterType == {{ inputConstraint }} { return {% call getMapName type1 %} { $0.{% call getMapName type2 %}(transform) } } {% endfor %} } - - - {% endfor %} diff --git a/Templates/Sources/FunctorTransformers3.stencil b/Templates/Sources/FunctorTransformers3.stencil index 8ccb59f..98f1583 100644 --- a/Templates/Sources/FunctorTransformers3.stencil +++ b/Templates/Sources/FunctorTransformers3.stencil @@ -1,40 +1,31 @@ {# GLOBAL MACROS #} - -{% macro getSecondaryParameter type level %}{% if type.annotations.secondaryParameter %}Secondary{{ level }},{% else %}{% endif %}{% endmacro %} - -{% macro getMapName type %}{% if type|annotated:"customMap" %}{{ type.annotations.customMap }}{% else %}map{% endif %}{% endmacro %} - -{% macro getTypeName type parameter secondaryParameter %}{{ type.name }}<{{ secondaryParameter }}{{ parameter }}>{% endmacro %} - {% macro checkEscaping3 type1 type2 type3 %}{% if type1.annotations.escapingHOF %}@escaping {% elif type2.annotations.escapingHOF %}@escaping {% elif type3.annotations.escapingHOF %}@escaping {% endif %}{% endmacro %} +{% macro getMapName type %}{% if type|annotated:"customMap" %}{{ type.annotations.customMap }}{% else %}map{% endif %}{% endmacro %} +{% macro getComma type %}{% if type.annotations.secondaryParameter %},{% else %}{% endif %}{% endmacro %} +{# GENERIC PARAMETER #} +{% macro getDefinitionGenericParameter type level %}{% if type.annotations.secondaryParameter %}Secondary{{level}}{% else %}{% endif %}{% endmacro %} +{# INPUT TYPE CONSTRAINT #} +{% macro getFirstLevelInputConstraint type primary level %}{% if type.annotations.secondaryParameter and type.annotations.secondaryParameterOnRight|annotated:"true" %}{{ type.name }}<{{ primary }}{% call getComma type %}{% call getDefinitionGenericParameter type level %}>{% elif type.annotations.secondaryParameter %}{{ type.name }}<{% call getDefinitionGenericParameter type level %}{% call getComma type %}{{ primary }}>{% else %}{{ type.name }}<{{ primary }}>{% endif %}{% endmacro %} +{% macro getSecondLevelInputConstraint outerType outerLevel innerType innerPrimary innerLevel %}{% if outerType.annotations.secondaryParameter and outerType.annotations.secondaryParameterOnRight|annotated:"true" %}{{ outerType.name }}<{% call getFirstLevelInputConstraint innerType innerPrimary innerLevel %}{% call getComma outerType %}{% call getDefinitionGenericParameter outerType outerLevel %}>{% elif outerType.annotations.secondaryParameter %}{{ outerType.name }}<{% call getDefinitionGenericParameter outerType outerLevel %}{% call getComma outerType %}{% call getFirstLevelInputConstraint innerType innerPrimary innerLevel %}>{% else %}{{ outerType.name }}<{% call getFirstLevelInputConstraint innerType innerPrimary innerLevel %}>{% endif %}{% endmacro %} +{# OUTPUT TYPE CONCRETE #} +{% macro getFirstLevelOutputConstraint type primary level %}{% if type.annotations.secondaryParameter and type.annotations.secondaryParameterOnRight|annotated:"true" %}{{ type.name }}<{{ primary }}{% call getComma type %}{% call getDefinitionGenericParameter type level %}>{% elif type.annotations.secondaryParameter %}{{ type.name }}<{% call getDefinitionGenericParameter type level %}{% call getComma type %}{{ primary }}>{% else %}{{ type.name }}<{{ primary }}>{% endif %}{% endmacro %} +{% macro getSecondLevelOutputConstraint outerType outerLevel innerType innerPrimary innerLevel %}{% if outerType.annotations.secondaryParameter and outerType.annotations.secondaryParameterOnRight|annotated:"true" %}{{ outerType.name }}<{% call getFirstLevelOutputConstraint innerType innerPrimary innerLevel %}{% call getComma outerType %}{% call getDefinitionGenericParameter outerType outerLevel %}>{% elif outerType.annotations.secondaryParameter %}{{ outerType.name }}<{% call getDefinitionGenericParameter outerType outerLevel %}{% call getComma outerType %}{% call getFirstLevelOutputConstraint innerType innerPrimary innerLevel %}>{% else %}{{ outerType.name }}<{% call getFirstLevelOutputConstraint innerType innerPrimary innerLevel %}>{% endif %}{% endmacro %} +{% macro getThirdLevelOutputConstraint outerType middleType middleLevel innerType innerPrimary innerLevel %}{% if outerType.annotations.secondaryParameter and outerType.annotations.secondaryParameterOnRight|annotated:"true" %}{{ outerType.name }}<{% call getSecondLevelOutputConstraint middleType middleLevel innerType innerPrimary innerLevel %}{% call getComma outerType %}{{ outerType.annotations.secondaryParameter }}>{% elif outerType.annotations.secondaryParameter %}{{ outerType.name }}<{{ outerType.annotations.secondaryParameter }}{% call getComma outerType %}{% call getSecondLevelOutputConstraint middleType middleLevel innerType innerPrimary innerLevel %}>{% else %}{{ outerType.name }}<{% call getSecondLevelOutputConstraint middleType middleLevel innerType innerPrimary innerLevel %}>{% endif %}{% endmacro %} {# TRANSFORMERS #} - {% for type1 in types.all|annotated:"functor" %} - public extension {{ type1.name }} { - {% for type2 in types.all|annotated:"functor" %} {% for type3 in types.all|annotated:"functor" %} - -{% set type3Secondary %}{% call getSecondaryParameter type3 "3" %}{% endset %} -{% set type3Constraint %}{% call getTypeName type3 "Input" type3Secondary %}{% endset %} -{% set type3Concrete %}{% call getTypeName type3 "Output" type3Secondary %}{% endset %} - -{% set type2Secondary %}{% call getSecondaryParameter type2 "2" %}{% endset %} -{% set type2Constraint %}{% call getTypeName type2 type3Constraint type2Secondary %}{% endset %} -{% set type2Concrete %}{% call getTypeName type2 type3Concrete type2Secondary %}{% endset %} - -{% set type1Secondary %}{% if type1.annotations.secondaryParameter %}{{ type1.annotations.secondaryParameter }},{% else %}{% endif %}{% endset %} -{% set type1Concrete %}{% call getTypeName type1 type2Concrete type1Secondary %}{% endset %} - - func mapTT <{{ type3Secondary }}{{ type2Secondary }}Input,Output> (_ transform: {% call checkEscaping3 type1 type2 type3 %}(Input) -> Output) -> {{ type1Concrete }} where ParameterType == {{ type2Constraint }} { +{% set genericSecondSecondaryParameter %}{% call getDefinitionGenericParameter type3 "3" %}{% call getComma type %}{% endset %} +{% set genericFirstSecondaryParameter %}{% call getDefinitionGenericParameter type2 "2" %}{% call getComma type %}{% endset %} +{% set inputConstraint %}{% call getSecondLevelInputConstraint type2 "2" type3 "Input" "3" %}{% endset %} +{% set outputConcreteType %}{% call getThirdLevelOutputConstraint type1 type2 "2" type3 "Output" "3"%}{% endset %} + func mapTT <{{ genericSecondSecondaryParameter }}{% call getComma type3 %}{{ genericFirstSecondaryParameter }}{% call getComma type2 %}Input,Output> (_ transform: {% call checkEscaping3 type1 type2 type3 %}(Input) -> Output) -> {{ outputConcreteType }} where ParameterType == {{ inputConstraint }} { return {% call getMapName type1 %} { $0.{% call getMapName type2 %} { $0.{% call getMapName type3 %}(transform) } } } + {% endfor %} {% endfor %} } - - - {% endfor %} diff --git a/Templates/Sources/MonadTransformers2.stencil b/Templates/Sources/MonadTransformers2.stencil index 81223ea..435985d 100644 --- a/Templates/Sources/MonadTransformers2.stencil +++ b/Templates/Sources/MonadTransformers2.stencil @@ -1,40 +1,29 @@ {# GLOBAL MACROS #} - -{% macro getSecondaryParameter type level %}{% if type.annotations.secondaryParameter %}Secondary{{ level }},{% else %}{% endif %}{% endmacro %} - {% macro getMapName type %}{% if type|annotated:"customMap" %}{{ type.annotations.customMap }}{% else %}map{% endif %}{% endmacro %} - {% macro getFlatMapName type %}{% if type|annotated:"customFlatMap" %}{{ type.annotations.customFlatMap }}{% else %}flatMap{% endif %}{% endmacro %} - -{% macro getTypeName type parameter secondaryParameter %}{{ type.name }}<{{ secondaryParameter }}{{ parameter }}>{% endmacro %} - {% macro checkEscaping2 type1 type2 %}{% if type1.annotations.escapingHOF %}@escaping {% elif type2.annotations.escapingHOF %}@escaping {% endif %}{% endmacro %} - {% macro getJoinedName type %}{% if type.annotations.alternativeJoined %}{{ type.annotations.alternativeJoined }}{% else %}joined(){% endif %}{% endmacro %} +{% macro getComma type %}{% if type.annotations.secondaryParameter %},{% else %}{% endif %}{% endmacro %} +{# GENERIC PARAMETER #} +{% macro getDefinitionGenericParameter type %}{% if type.annotations.secondaryParameter %}Secondary{% else %}{% endif %}{% endmacro %} +{# INPUT TYPE CONSTRAINT #} +{% macro getInputConstraint type primary %}{% if type.annotations.secondaryParameter and type.annotations.secondaryParameterOnRight|annotated:"true" %}{{ type.name }}<{{ primary }}{% call getComma type %}{% call getDefinitionGenericParameter type %}>{% elif type.annotations.secondaryParameter %}{{ type.name }}<{% call getDefinitionGenericParameter type %}{% call getComma type %}{{ primary }}>{% else %}{{ type.name }}<{{ primary }}>{% endif %}{% endmacro %} +{# OUTPUT TYPE CONCRETE #} +{% macro getPrimaryGenericConcreteParameter type primary %}{% if type.annotations.secondaryParameter and type.annotations.secondaryParameterOnRight|annotated:"true" %}{{ type.name }}<{{ primary }}{% call getComma type %}{% call getDefinitionGenericParameter type %}>{% elif type.annotations.secondaryParameter %}{{ type.name }}<{% call getDefinitionGenericParameter type %}{% call getComma type %}{{ primary }}>{% else %}{{ type.name }}<{{ primary }}>{% endif %}{% endmacro %} +{% macro getOutputConcreteType type1 type2 primary %}{% if type1.annotations.secondaryParameter and type1.annotations.secondaryParameterOnRight|annotated:"true" %}{{ type1.name }}<{% call getPrimaryGenericConcreteParameter type2 primary %}{% call getComma type1 %}{{ type1.annotations.secondaryParameter }}>{% elif type1.annotations.secondaryParameter %}{{ type1.name }}<{{ type1.annotations.secondaryParameter }}{% call getComma type1 %}{% call getPrimaryGenericConcreteParameter type2 primary %}>{% else %}{{type1.name}}<{% call getPrimaryGenericConcreteParameter type2 primary %}>{% endif %}{% endmacro %} {# TRANSFORMERS #} - {% for type1 in types.all|annotated:"functor"|annotated:"monad"|!annotated:"customTransformer" %} - public extension {{ type1.name }} { - {% for type2 in types.all|annotated:"functor"|annotated:"monad"|annotated:"traversable" %} - -{% set type2Secondary %}{% call getSecondaryParameter type2 "2" %}{% endset %} -{% set type2Constraint %}{% call getTypeName type2 "Input" type2Secondary %}{% endset %} -{% set type2Concrete %}{% call getTypeName type2 "Output" type2Secondary %}{% endset %} - -{% set type1Secondary %}{% if type1.annotations.secondaryParameter %}{{ type1.annotations.secondaryParameter }},{% else %}{% endif %}{% endset %} -{% set type1Concrete %}{% call getTypeName type1 type2Concrete type1Secondary %}{% endset %} - - func flatMapT <{{ type2Secondary }}Input,Output> (_ transform: {% call checkEscaping2 type1 type2 %}(Input) -> {{ type1Concrete }}) -> {{ type1Concrete }} where ParameterType == {{ type2Constraint }} { - return {% call getFlatMapName type1 %} { (value) -> {{ type1Concrete }} in +{% set genericSecondaryParameter %}{% call getDefinitionGenericParameter type2 %}{% call getComma type2 %}{% endset %} +{% set inputConstraint %}{% call getInputConstraint type2 "Input" %}{% endset %} +{% set outputType %}{% call getOutputConcreteType type1 type2 "Output" %}{% endset %} + func flatMapT <{{ genericSecondaryParameter }}Input,Output> (_ transform: {% call checkEscaping2 type1 type2 %}(Input) -> {{ outputType }}) -> {{ outputType }} where ParameterType == {{ inputConstraint }} { + return {% call getFlatMapName type1 %} { (value) -> {{ outputType }} in value.traverse(transform).{% call getMapName type1 %} { $0.{% call getJoinedName type2 %} } } } {% endfor %} } - - - {% endfor %} diff --git a/Templates/Sources/MonadTransformers3.stencil b/Templates/Sources/MonadTransformers3.stencil index f4dcc37..ac2e571 100644 --- a/Templates/Sources/MonadTransformers3.stencil +++ b/Templates/Sources/MonadTransformers3.stencil @@ -1,39 +1,30 @@ {# GLOBAL MACROS #} - -{% macro getSecondaryParameter type level %}{% if type.annotations.secondaryParameter %}Secondary{{ level }},{% else %}{% endif %}{% endmacro %} - {% macro getMapName type %}{% if type|annotated:"customMap" %}{{ type.annotations.customMap }}{% else %}map{% endif %}{% endmacro %} - {% macro getFlatMapName type %}{% if type|annotated:"customFlatMap" %}{{ type.annotations.customFlatMap }}{% else %}flatMap{% endif %}{% endmacro %} - -{% macro getTypeName type parameter secondaryParameter %}{{ type.name }}<{{ secondaryParameter }}{{ parameter }}>{% endmacro %} - {% macro checkEscaping3 type1 type2 type3 %}{% if type1.annotations.escapingHOF %}@escaping {% elif type2.annotations.escapingHOF %}@escaping {% elif type3.annotations.escapingHOF %}@escaping {% endif %}{% endmacro %} - {% macro getJoinedName type %}{% if type.annotations.alternativeJoined %}{{ type.annotations.alternativeJoined }}{% else %}joined(){% endif %}{% endmacro %} +{% macro getComma type %}{% if type.annotations.secondaryParameter %},{% else %}{% endif %}{% endmacro %} +{# GENERIC PARAMETER #} +{% macro getDefinitionGenericParameter type level %}{% if type.annotations.secondaryParameter %}Secondary{{level}}{% else %}{% endif %}{% endmacro %} +{# INPUT TYPE CONSTRAINT #} +{% macro getFirstLevelInputConstraint type primary level %}{% if type.annotations.secondaryParameter and type.annotations.secondaryParameterOnRight|annotated:"true" %}{{ type.name }}<{{ primary }}{% call getComma type %}{% call getDefinitionGenericParameter type level %}>{% elif type.annotations.secondaryParameter %}{{ type.name }}<{% call getDefinitionGenericParameter type level %}{% call getComma type %}{{ primary }}>{% else %}{{ type.name }}<{{ primary }}>{% endif %}{% endmacro %} +{% macro getSecondLevelInputConstraint outerType outerLevel innerType innerPrimary innerLevel %}{% if outerType.annotations.secondaryParameter and outerType.annotations.secondaryParameterOnRight|annotated:"true" %}{{ outerType.name }}<{% call getFirstLevelInputConstraint innerType innerPrimary innerLevel %}{% call getComma outerType %}{% call getDefinitionGenericParameter outerType outerLevel %}>{% elif outerType.annotations.secondaryParameter %}{{ outerType.name }}<{% call getDefinitionGenericParameter outerType outerLevel %}{% call getComma outerType %}{% call getFirstLevelInputConstraint innerType innerPrimary innerLevel %}>{% else %}{{ outerType.name }}<{% call getFirstLevelInputConstraint innerType innerPrimary innerLevel %}>{% endif %}{% endmacro %} +{# OUTPUT TYPE CONCRETE #} +{% macro getFirstLevelOutputConstraint type primary level %}{% if type.annotations.secondaryParameter and type.annotations.secondaryParameterOnRight|annotated:"true" %}{{ type.name }}<{{ primary }}{% call getComma type %}{% call getDefinitionGenericParameter type level %}>{% elif type.annotations.secondaryParameter %}{{ type.name }}<{% call getDefinitionGenericParameter type level %}{% call getComma type %}{{ primary }}>{% else %}{{ type.name }}<{{ primary }}>{% endif %}{% endmacro %} +{% macro getSecondLevelOutputConstraint outerType outerLevel innerType innerPrimary innerLevel %}{% if outerType.annotations.secondaryParameter and outerType.annotations.secondaryParameterOnRight|annotated:"true" %}{{ outerType.name }}<{% call getFirstLevelOutputConstraint innerType innerPrimary innerLevel %}{% call getComma outerType %}{% call getDefinitionGenericParameter outerType outerLevel %}>{% elif outerType.annotations.secondaryParameter %}{{ outerType.name }}<{% call getDefinitionGenericParameter outerType outerLevel %}{% call getComma outerType %}{% call getFirstLevelOutputConstraint innerType innerPrimary innerLevel %}>{% else %}{{ outerType.name }}<{% call getFirstLevelOutputConstraint innerType innerPrimary innerLevel %}>{% endif %}{% endmacro %} +{% macro getThirdLevelOutputConstraint outerType middleType middleLevel innerType innerPrimary innerLevel %}{% if outerType.annotations.secondaryParameter and outerType.annotations.secondaryParameterOnRight|annotated:"true" %}{{ outerType.name }}<{% call getSecondLevelOutputConstraint middleType middleLevel innerType innerPrimary innerLevel %}{% call getComma outerType %}{{ outerType.annotations.secondaryParameter }}>{% elif outerType.annotations.secondaryParameter %}{{ outerType.name }}<{{ outerType.annotations.secondaryParameter }}{% call getComma outerType %}{% call getSecondLevelOutputConstraint middleType middleLevel innerType innerPrimary innerLevel %}>{% else %}{{ outerType.name }}<{% call getSecondLevelOutputConstraint middleType middleLevel innerType innerPrimary innerLevel %}>{% endif %}{% endmacro %} {# TRANSFORMERS #} - {% for type1 in types.all|annotated:"functor"|annotated:"monad"|!annotated:"customTransformer" %} - public extension {{ type1.name }} { - {% for type2 in types.all|annotated:"functor"|annotated:"monad"|annotated:"traversable" %} {% for type3 in types.all|annotated:"functor"|annotated:"monad"|annotated:"traversable" %} - -{% set type3Secondary %}{% call getSecondaryParameter type3 "3" %}{% endset %} -{% set type3Constraint %}{% call getTypeName type3 "Input" type3Secondary %}{% endset %} -{% set type3Concrete %}{% call getTypeName type3 "Output" type3Secondary %}{% endset %} - -{% set type2Secondary %}{% call getSecondaryParameter type2 "2" %}{% endset %} -{% set type2Constraint %}{% call getTypeName type2 type3Constraint type2Secondary %}{% endset %} -{% set type2Concrete %}{% call getTypeName type2 type3Concrete type2Secondary %}{% endset %} - -{% set type1Secondary %}{% if type1.annotations.secondaryParameter %}{{ type1.annotations.secondaryParameter }},{% else %}{% endif %}{% endset %} -{% set type1Concrete %}{% call getTypeName type1 type2Concrete type1Secondary %}{% endset %} - - func flatMapTT <{{ type3Secondary }}{{ type2Secondary }}Input,Output> (_ transform: {% call checkEscaping3 type1 type2 type3 %}(Input) -> {{ type1Concrete }}) -> {{ type1Concrete }} where ParameterType == {{ type2Constraint }} { - return flatMapT { (value) -> {{ type1Concrete }} in +{% set genericSecondSecondaryParameter %}{% call getDefinitionGenericParameter type3 "3" %}{% call getComma type %}{% endset %} +{% set genericFirstSecondaryParameter %}{% call getDefinitionGenericParameter type2 "2" %}{% call getComma type %}{% endset %} +{% set inputConstraint %}{% call getSecondLevelInputConstraint type2 "2" type3 "Input" "3" %}{% endset %} +{% set outputConcreteType %}{% call getThirdLevelOutputConstraint type1 type2 "2" type3 "Output" "3"%}{% endset %} + func flatMapTT <{{ genericSecondSecondaryParameter }}{% call getComma type3 %}{{ genericFirstSecondaryParameter }}{% call getComma type2 %}Input,Output> (_ transform: {% call checkEscaping3 type1 type2 type3 %}(Input) -> {{ outputConcreteType }}) -> {{ outputConcreteType }} where ParameterType == {{ inputConstraint }} { + return flatMapT { (value) -> {{ outputConcreteType }} in value.traverse(transform).{% call getMapName type1 %} { $0.traverse(f.identity) }.mapT { $0.{% call getJoinedName type3 %} } } } diff --git a/Templates/Sources/ReaderTransformer.stencil b/Templates/Sources/ReaderTransformer.stencil index c37fe41..3baa051 100644 --- a/Templates/Sources/ReaderTransformer.stencil +++ b/Templates/Sources/ReaderTransformer.stencil @@ -1,71 +1,56 @@ {# GLOBAL MACROS #} - -{% macro getSecondaryParameter type level %}{% if type.annotations.secondaryParameter %}Secondary{{ level }},{% else %}{% endif %}{% endmacro %} - {% macro getMapName type %}{% if type|annotated:"customMap" %}{{ type.annotations.customMap }}{% else %}map{% endif %}{% endmacro %} - {% macro getFlatMapName type %}{% if type|annotated:"customFlatMap" %}{{ type.annotations.customFlatMap }}{% else %}flatMap{% endif %}{% endmacro %} - -{% macro getTypeName type parameter secondaryParameter %}{{ type.name }}<{{ secondaryParameter }}{{ parameter }}>{% endmacro %} - {% macro checkEscaping2 type1 type2 %}{% if type1.annotations.escapingHOF %}@escaping {% elif type2.annotations.escapingHOF %}@escaping {% endif %}{% endmacro %} - {% macro checkEscaping3 type1 type2 type3 %}{% if type1.annotations.escapingHOF %}@escaping {% elif type2.annotations.escapingHOF %}@escaping {% elif type3.annotations.escapingHOF %}@escaping {% endif %}{% endmacro %} - {% macro checkEscaping4 type1 type2 type3 type4 %}{% if type1.annotations.escapingHOF %}@escaping {% elif type2.annotations.escapingHOF %}@escaping {% elif type3.annotations.escapingHOF %}@escaping {% elif type4.annotations.escapingHOF %}@escaping {% endif %}{% endmacro %} +{% macro getComma type %}{% if type.annotations.secondaryParameter %},{% else %}{% endif %}{% endmacro %} +{# GENERIC PARAMETER #} +{% macro getDefinitionGenericParameter type level %}{% if type.annotations.secondaryParameter %}Secondary{{level}}{% else %}{% endif %}{% endmacro %} +{# INPUT TYPE CONSTRAINT #} +{% macro getFirstLevelInputConstraint type primary level %}{% if type.annotations.secondaryParameter and type.annotations.secondaryParameterOnRight|annotated:"true" %}{{ type.name }}<{{ primary }}{% call getComma type %}{% call getDefinitionGenericParameter type level %}>{% elif type.annotations.secondaryParameter %}{{ type.name }}<{% call getDefinitionGenericParameter type level %}{% call getComma type %}{{ primary }}>{% else %}{{ type.name }}<{{ primary }}>{% endif %}{% endmacro %} +{% macro getSecondLevelInputConstraint outerType outerLevel innerType innerPrimary innerLevel %}{% if outerType.annotations.secondaryParameter and outerType.annotations.secondaryParameterOnRight|annotated:"true" %}{{ outerType.name }}<{% call getFirstLevelInputConstraint innerType innerPrimary innerLevel %}{% call getComma outerType %}{% call getDefinitionGenericParameter outerType outerLevel %}>{% elif outerType.annotations.secondaryParameter %}{{ outerType.name }}<{% call getDefinitionGenericParameter outerType outerLevel %}{% call getComma outerType %}{% call getFirstLevelInputConstraint innerType innerPrimary innerLevel %}>{% else %}{{ outerType.name }}<{% call getFirstLevelInputConstraint innerType innerPrimary innerLevel %}>{% endif %}{% endmacro %} +{% macro getThirdLevelInputConstraint firstType firstLevel secondType secondLevel thirdType thirdPrimary thirdLevel %}{% if firstType.annotations.secondaryParameter and firstType.annotations.secondaryParameterOnRight|annotated:"true" %}{{ firstType.name }}<{% call getSecondLevelInputConstraint secondType secondLevel thirdType thirdPrimary thirdLevel %}{% call getComma firstType %}{% call getDefinitionGenericParameter firstType firstLevel %}>{% elif firstType.annotations.secondaryParameter %}{{ firstType.name }}<{% call getDefinitionGenericParameter firstType firstLevel %}{% call getComma firstType %}{% call getSecondLevelInputConstraint secondType secondLevel thirdType thirdPrimary thirdLevel %}>{% else %}{{ firstType.name }}<{% call getSecondLevelInputConstraint secondType secondLevel thirdType thirdPrimary thirdLevel %}>{% endif %}{% endmacro %} +{# OUTPUT TYPE CONCRETE #} +{% macro getFirstLevelOutputConstraint type primary level %}{% if type.annotations.secondaryParameter and type.annotations.secondaryParameterOnRight|annotated:"true" %}{{ type.name }}<{{ primary }}{% call getComma type %}{% call getDefinitionGenericParameter type level %}>{% elif type.annotations.secondaryParameter %}{{ type.name }}<{% call getDefinitionGenericParameter type level %}{% call getComma type %}{{ primary }}>{% else %}{{ type.name }}<{{ primary }}>{% endif %}{% endmacro %} +{% macro getSecondLevelOutputConstraint outerType outerLevel innerType innerPrimary innerLevel %}{% if outerType.annotations.secondaryParameter and outerType.annotations.secondaryParameterOnRight|annotated:"true" %}{{ outerType.name }}<{% call getFirstLevelOutputConstraint innerType innerPrimary innerLevel %}{% call getComma outerType %}{% call getDefinitionGenericParameter outerType outerLevel %}>{% elif outerType.annotations.secondaryParameter %}{{ outerType.name }}<{% call getDefinitionGenericParameter outerType outerLevel %}{% call getComma outerType %}{% call getFirstLevelOutputConstraint innerType innerPrimary innerLevel %}>{% else %}{{ outerType.name }}<{% call getFirstLevelOutputConstraint innerType innerPrimary innerLevel %}>{% endif %}{% endmacro %} +{% macro getThirdLevelOutputConstraint outerType outerLevel middleType middleLevel innerType innerPrimary innerLevel %}{% if outerType.annotations.secondaryParameter and outerType.annotations.secondaryParameterOnRight|annotated:"true" %}{{ outerType.name }}<{% call getSecondLevelOutputConstraint middleType middleLevel innerType innerPrimary innerLevel %}{% call getComma outerType %}{% call getDefinitionGenericParameter outerType outerLevel %}>{% elif outerType.annotations.secondaryParameter %}{{ outerType.name }}<{% call getDefinitionGenericParameter outerType outerLevel %}{% call getComma outerType %}{% call getSecondLevelOutputConstraint middleType middleLevel innerType innerPrimary innerLevel %}>{% else %}{{ outerType.name }}<{% call getSecondLevelOutputConstraint middleType middleLevel innerType innerPrimary innerLevel %}>{% endif %}{% endmacro %} {# TRANSFORMERS #} - public extension Reader { - {% for type1 in types.all|annotated:"monad" %} - -{% set type1Secondary %}{% call getSecondaryParameter type1 "1" %}{% endset %} -{% set type1Constraint %}{% call getTypeName type1 "Input" type1Secondary %}{% endset %} -{% set type1Concrete %}{% call getTypeName type1 "Output" type1Secondary %}{% endset %} - - func flatMapT <{{ type1Secondary }}Input,Output> (_ transform: @escaping (Input) -> Reader) -> Reader where ParameterType == {{ type1Constraint }} { - return Reader.init { e in + {% set genericSecondaryFlatMapTParameter %}{% call getDefinitionGenericParameter type1 "" %}{% endset %} + {% set inputFlatMapTConstraint %}{% call getFirstLevelInputConstraint type1 "Input" "" %}{% endset %} + {% set outputFlatMapTType %}{% call getFirstLevelOutputConstraint type1 "Output" "" %}{% endset %} + func flatMapT <{{ genericSecondaryFlatMapTParameter }}{% call getComma type1 %}Input,Output> (_ transform: @escaping (Input) -> Reader) -> Reader where ParameterType == {{ inputFlatMapTConstraint }} { + return Reader.init { e in self.run(e).{% call getFlatMapName type1 %} { transform($0).run(e) } } } {% for type2 in types.all|annotated:"monad"|annotated:"traversable" %} - -{% set type2Secondary %}{% call getSecondaryParameter type2 "2" %}{% endset %} -{% set type2Constraint %}{% call getTypeName type2 "Input" type2Secondary %}{% endset %} -{% set type2Concrete %}{% call getTypeName type2 "Output" type2Secondary %}{% endset %} - -{% set type1Secondary %}{% call getSecondaryParameter type1 "1" %}{% endset %} -{% set type1Constraint %}{% call getTypeName type1 type2Constraint type1Secondary %}{% endset %} -{% set type1Concrete %}{% call getTypeName type1 type2Concrete type1Secondary %}{% endset %} - - func flatMapTT <{{ type2Secondary }}{{ type1Secondary }}Input,Output> (_ transform: @escaping (Input) -> Reader) -> Reader where ParameterType == {{ type1Constraint }} { - return Reader.init { e in + {% set genericSecondSecondaryFlatMapTTParameter %}{% call getDefinitionGenericParameter type2 "2" %}{% call getComma type %}{% endset %} + {% set genericFirstSecondaryFlatMapTTParameter %}{% call getDefinitionGenericParameter type1 "1" %}{% call getComma type %}{% endset %} + {% set inputFlatMapTTConstraint %}{% call getSecondLevelInputConstraint type1 "1" type2 "Input" "2" %}{% endset %} + {% set outputFlatMapTTConcreteType %}{% call getSecondLevelOutputConstraint type1 "1" type2 "Output" "2" %}{% endset %} + func flatMapTT <{{ genericSecondSecondaryFlatMapTTParameter }}{% call getComma type2 %}{{ genericFirstSecondaryFlatMapTTParameter }}{% call getComma type1 %}Input,Output> (_ transform: @escaping (Input) -> Reader) -> Reader where ParameterType == {{ inputFlatMapTTConstraint }} { + return Reader.init { e in self.run(e).flatMapT { transform($0).run(e) } } } {% for type3 in types.all|annotated:"monad"|annotated:"traversable" %} - -{% set type3Secondary %}{% call getSecondaryParameter type3 "3" %}{% endset %} -{% set type3Constraint %}{% call getTypeName type3 "Input" type3Secondary %}{% endset %} -{% set type3Concrete %}{% call getTypeName type3 "Output" type3Secondary %}{% endset %} - -{% set type2Secondary %}{% call getSecondaryParameter type2 "2" %}{% endset %} -{% set type2Constraint %}{% call getTypeName type2 type3Constraint type2Secondary %}{% endset %} -{% set type2Concrete %}{% call getTypeName type2 type3Concrete type2Secondary %}{% endset %} - -{% set type1Secondary %}{% call getSecondaryParameter type1 "1" %}{% endset %} -{% set type1Constraint %}{% call getTypeName type1 type2Constraint type1Secondary %}{% endset %} -{% set type1Concrete %}{% call getTypeName type1 type2Concrete type1Secondary %}{% endset %} - - func flatMapTTT <{{ type3Secondary }}{{ type2Secondary }}{{ type1Secondary }}Input,Output> (_ transform: @escaping (Input) -> Reader) -> Reader where ParameterType == {{ type1Constraint }} { - return Reader.init { e in + {% set genericThirdSecondaryFlatMapTTTParameter %}{% call getDefinitionGenericParameter type3 "3" %}{% call getComma type %}{% endset %} + {% set genericSecondSecondaryFlatMapTTTParameter %}{% call getDefinitionGenericParameter type2 "2" %}{% call getComma type %}{% endset %} + {% set genericFirstSecondaryFlatMapTTTParameter %}{% call getDefinitionGenericParameter type1 "1" %}{% call getComma type %}{% endset %} + {% set inputFlatMapTTTConstraint %}{% call getThirdLevelInputConstraint type1 "1" type2 "2" type3 "Input" "3" %}{% endset %} + {% set outputFlatMapTTTConcreteType %}{% call getThirdLevelOutputConstraint type1 "1" type2 "2" type3 "Output" "3" %}{% endset %} + func flatMapTTT<{{ genericThirdSecondaryFlatMapTTTParameter }}{% call getComma type3 %}{{ genericSecondSecondaryFlatMapTTTParameter }}{% call getComma type2 %}{{ genericFirstSecondaryFlatMapTTTParameter }}{% call getComma type1 %}Input,Output> (_ transform: @escaping (Input) -> Reader) -> Reader where ParameterType == {{ inputFlatMapTTTConstraint }} { + return Reader.init { e in self.run(e).flatMapTT { transform($0).run(e) } } } - + {% endfor %} {% endfor %} {% endfor %} diff --git a/Templates/Tests/LawsTests.stencil b/Templates/Tests/LawsTests.stencil index cfbf6b8..6ca2c39 100644 --- a/Templates/Tests/LawsTests.stencil +++ b/Templates/Tests/LawsTests.stencil @@ -1,5 +1,5 @@ {# GLOBAL MACROS #} -{% macro getTypeName type parameter %}{{ type.name }}<{% if type|annotated:"testSecondaryParameter" %}String,{% endif %}{{ parameter }}>{% endmacro %} +{% macro getTypeName type parameter %}{{ type.name }}{% if type|annotated:"testSecondaryParameter" and type.annotations.secondaryParameterOnRight|annotated:"true"%}<{{ parameter }},String>{% elif type|annotated:"testSecondaryParameter" %}{% else %}<{{ parameter }}>{% endif %}{% endmacro %} {% macro getMapName type %}{% if type|annotated:"customMap" %}{{ type.annotations.customMap }}{% else %}map{% endif %}{% endmacro %} {% macro getFlatMapName type %}{% if type|annotated:"customFlatMap" %}{{ type.annotations.customFlatMap }}{% else %}flatMap{% endif %}{% endmacro %} {% macro getCommandCall type %}{% if type|annotated:"testNeedsCommand" %}.{{ type.annotations.testNeedsCommand }}{% endif %}{% endmacro %} diff --git a/Tests/FunctionalKitTests/LawsTests.generated.swift b/Tests/FunctionalKitTests/LawsTests.generated.swift index a857c16..3a2a6df 100644 --- a/Tests/FunctionalKitTests/LawsTests.generated.swift +++ b/Tests/FunctionalKitTests/LawsTests.generated.swift @@ -600,7 +600,7 @@ class LawsTests: XCTestCase { func testResultApplicativeIdentity() { property("Result - Applicative Laws - Identity") <- forAll { (x: String) in - let a_a = Result>.pure(f.identity) + let a_a = Result,String>.pure(f.identity) let a = Result.pure(x) return ((a_a <*> a) == a) } @@ -608,7 +608,7 @@ class LawsTests: XCTestCase { func testResultApplicativeHomomorphism() { property("Result - Applicative Laws - Homomorphism") <- forAll { (af: ArrowOf, x: String) in - let a_a = Result>.pure(af.getArrow) + let a_a = Result,String>.pure(af.getArrow) let a1 = Result.pure(x) let a2 = Result.pure(af.getArrow(x)) return ((a_a <*> a1) == a2) @@ -618,9 +618,9 @@ class LawsTests: XCTestCase { /* func testResultApplicativeInterchange() { property("Result - Applicative Laws - Interchange") <- forAll { (af: ArrowOf, x: String) in - let a_a = Result>.pure(af.getArrow) + let a_a = Result,String>.pure(af.getArrow) let a = Result.pure(x) - let a_a_a = Result) -> String>.pure { $0(x) } + let a_a_a = Result<(@escaping Endo) -> String,String>.pure { $0(x) } return ((a_a <*> a) == (a_a_a <*> a_a)) } } @@ -628,9 +628,9 @@ class LawsTests: XCTestCase { func testResultApplicativeComposition() { property("Result - Applicative Laws - Interchange") <- forAll { (af: ArrowOf, ag: ArrowOf, x: String) in let a = Result.pure(x) - let a_a1 = Result>.pure(af.getArrow) - let a_a2 = Result>.pure(ag.getArrow) - let a_a_a = Result) -> (@escaping Endo) -> Endo>.pure(f.curry(f.compose)) + let a_a1 = Result,String>.pure(af.getArrow) + let a_a2 = Result,String>.pure(ag.getArrow) + let a_a_a = Result<(@escaping Endo) -> (@escaping Endo) -> Endo,String>.pure(f.curry(f.compose)) return ((a_a_a <*> a_a1 <*> a_a2 <*> a) == (a_a2 <*> (a_a1 <*> a))) } } diff --git a/Tests/FunctionalKitTests/ResultTests.swift b/Tests/FunctionalKitTests/ResultTests.swift index 9bd7c9c..065812a 100644 --- a/Tests/FunctionalKitTests/ResultTests.swift +++ b/Tests/FunctionalKitTests/ResultTests.swift @@ -11,7 +11,7 @@ class ResultTests: XCTestCase { case error } - typealias TestResultType = Result + typealias TestResultType = Result func testLiftOneArg() { let id: (Int) -> Int = {$0}