             case .Rejected(let error):
                 rejecter(error)
             case .Fulfilled(let value):
-                fulfiller(value as T)
+                fulfiller(value())
             case .Pending:
                 promise.handlers.append{
                     switch promise.state {
                     case .Rejected(let error):
                         rejecter(error)
                     case .Fulfilled(let value):
-                        fulfiller(value as T)
+                        fulfiller(value())
                     case .Pending:
                         abort()
                     }

import Foundation
import UIKit

enum State {   //TODO generics! Type T! Nested! (can't now due to compiler bugs)
    case Pending
    case Fulfilled(Any)
    case Rejected(NSError)
}


            switch self.state {
            case .Fulfilled(let value):
                body()
                fulfiller(value())
            case .Rejected(let error):
                body()
                rejecter(error)
