           (.setStackTrace e' (.getStackTrace e))
           (throw e')))))
 
-  IPromise
+  IPromiseState
   (rejected* [_]
     (.isCompletedExceptionally cf))
 

  (pending* [_]
    (not (.isDone cf)))

  (then* [_ callback]
    (let [cf' (.thenApply cf (reify java.util.function.Function
                               (apply [_ v]

;; The main abstraction definition.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(defprotocol IPromiseState
  "Additional state related abstraction."
  (^:private rejected* [_] "Returns true if a promise is rejected.")
  (^:private resolved* [_] "Returns true if a promise is resolved.")
  (^:private done* [_] "Retutns true if a promise is already done.")
  (^:private pending* [_] "Retutns true if a promise is stil pending."))

(defprotocol IPromise
  "A basic promise abstraction."
  (^:private then* [_ callback] "Chain a promise.")
  (^:private error* [_ callback] "Catch a error in a promise."))

