 }
 
 // MARK: - Optional -
+
 public extension Optional {
     func filter(predicate: Wrapped -> Bool) -> Wrapped? {
         switch self {

        }
    }

    // MARK: Future Combinators
    public func map<M>(executionContext: ExecutionContext = QueueContext.futuresDefault, mapping: T -> Try<M>) -> Future<M> {
        let future = Future<M>()
        onComplete(executionContext) { result in
            future.complete(result.flatMap(mapping))
        }
        return future
    }
    
    public func flatMap<M>(executionContext: ExecutionContext = QueueContext.futuresDefault, mapping: T -> Future<M>) -> Future<M> {
        let future = Future<M>()
        onComplete(executionContext) { result in
            switch result {
            case .Success(let value):
                future.completeWith(executionContext, future: mapping(value))

import Foundation

// MARK: - Errors -

enum SimpleFuturesErrors: Int, ErrorType {
    case futureCompleted = 0
    case futureNotCompleted = 1
