From b4ed0850abccf641af7aa25bff3a5dc2db74cd07 Mon Sep 17 00:00:00 2001 From: Gordon Fontenot Date: Fri, 15 Jan 2016 15:45:49 -0700 Subject: [PATCH] Add leftwise flatMap operator for Decoded This version of the operator was left out for some reason. This wasn't intentional, so we're just correcting the oversight. --- Argo/Types/Decoded/Monad.swift | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Argo/Types/Decoded/Monad.swift b/Argo/Types/Decoded/Monad.swift index ecbe84f..6a4c3af 100644 --- a/Argo/Types/Decoded/Monad.swift +++ b/Argo/Types/Decoded/Monad.swift @@ -13,6 +13,21 @@ public func >>- (x: Decoded, @noescape f: T -> Decoded) -> Decoded` + - parameter f: A transformation function from type `T` to type `Decoded` + + - returns: A value of type `Decoded` +*/ +public func -<< (@noescape f: T -> Decoded, x: Decoded) -> Decoded { + return x.flatMap(f) +} + public extension Decoded { func flatMap(@noescape f: T -> Decoded) -> Decoded { switch self {