     self.appState = state
 
     self.stateSource = self.stateSubject.asObservable()
-    let actionSource = self.actionEmitter.observable
 
     self.httpService = HttpServerService(port: baseServerUrl.port!)
 


extension Observable {

  fileprivate func reduce<T:Reducer>(by transformer: T) -> Observable<Element> where T.Pair == Element {
    return transformer.reduce(self)
  }

  // If the following is used, the compiler does not finish...
//  fileprivate func transform<T:Reducer>(by transformers: [T]) -> Observable<Element> where T.Element == Element {
//    return transformers.reduce(self) { (result: Observable<Element>, transformer: T) -> Observable<Element> in
//      transformer.transform(result)
//    }
//  }

  fileprivate func apply<S:Service>(to service: S) -> Observable<Element> where S.Pair == Element {
    return self.do(onNext: service.apply)

    }
  }

  fileprivate func actionSourceForAppState<T>() -> Observable<StateActionPair<AppState, T>> {
    return self.actionEmitter.observable
      .mapOmittingNil { $0 as? T }
      .map { self.appStateActionPair(for: $0) }
  }

  fileprivate func actionSourceForMainWindow<T>() -> Observable<StateActionPair<UuidState<MainWindow.State>, T>> {
    return self.actionEmitter.observable
      .mapOmittingNil { $0 as? UuidAction<T> }
      .mapOmittingNil { self.mainWindowStateActionPair(for: $0) }
  }

  fileprivate func appStateActionPair<ActionType>(for action: ActionType) -> StateActionPair<AppState, ActionType> {
    return StateActionPair(state: self.appState, action: action, modified: false)
  }
