  */
 public protocol Publisher {
     associatedtype Publishing
+
     /**
      Adds a handler to a generic event.
 

    private func publish(newState: State) {
        subscribers.values.forEach { $0(newState) }
    }
}

/**


extension Dispatcher {
    /**
     Executes a closure with an injected `dispatch` function. 
     Useful asynchronous `Action` dispatches.

     - parameter thunk: The closure that will be executed with an injected `dispatch` function.
     */
    public func dispatch(thunk: (Action -> Void) -> Void) {
        thunk(self.dispatch)
    }
}

extension Dispatcher where Self: StateReading {
    /**
     Executes a closure with an injected `dispatch` function and a state accessor. 
     Allows asynchronous `Action` dispatches as well as decisions based on
     the current state.

     - parameter thunk: The closure that will be executed with 
     an injected `dispatch` function and a state accessor.
     */
    public func dispatch(thunk: ((Action -> Void), (Void -> State)) -> Void) {
        thunk(dispatch, getState)
    }
}

