 //  Copyright (c) 2014 Rob Rix. All rights reserved.
+
+// MARK: - Either (definition)
 
 /// A type representing an alternative of one of two types.
 ///
 /// By convention, and where applicable, `Left` is used to indicate failure, while `Right` is used to indicate success. (Mnemonic: “right” is a synonym for “correct.”)
 ///
 /// Otherwise, it is implied that `Left` and `Right` are effectively unordered alternatives of equal standing.
-public enum Either<T, U>: EitherProtocol, CustomDebugStringConvertible, CustomStringConvertible {
+public enum Either<T, U> {
 	case left(T)
 	case right(U)
+}
 
+// MARK: - Either : EitherProtocol
 
-	// MARK: Lifecycle
-
+extension Either: EitherProtocol {
 	/// Constructs a `Left`.
 	///
 	/// Suitable for partial application.
 	public static func toLeft(_ value: T) -> Either {
 		return .left(value)
 	}
-
+	
 	/// Constructs a `Right`.
 	///
 	/// Suitable for partial application.
 	public static func toRight(_ value: U) -> Either {
 		return .right(value)
 	}
-
-
-	// MARK: API
-
+	
 	/// Returns the result of applying `f` to the value of `Left`, or `g` to the value of `Right`.
 	public func either<Result>(ifLeft: (T) throws -> Result, ifRight: (U) throws -> Result) rethrows -> Result {
 		switch self {

}


// MARK: - Free functions

/// If `left` is `Either.Right`, extracts its value and passes it to `transform`, returning the result; otherwise transforms `either` into the return type.
///
/// This is the bind or flat map operator, and is useful for chaining computations taking some parameter and returning an `Either`.
public func >>- <T, U, V> (either: Either<T, U>, transform: (U) -> Either<T, V>) -> Either<T, V> {
	return either.flatMap(transform)
}


// MARK: - Operators


			return try ifRight(x)
		}
	}
}

// MARK: - Either : CustomStringConvertible

extension Either: CustomStringConvertible {
	public var description: String {
		return either(
			ifLeft: { ".Left(\($0))"},
