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

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)
}


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