title: RxSwift: Mapping a completable to single observable?
body: <p>I am trying to do a couple of actions in sequence, using RxSwift and am unsure how to get it working. </p>
  
  <p>The problem is returning a <code>Single</code> observable, where the success/error depends on whether a <code>Completable</code> call succeeds or fails.</p>
  
  <p>My code attempt looks roughly like this:</p>
  
  <pre><code>func doSomething(with value: SomeType) -&gt; Single&lt;SomeType&gt; {
      return repository.replace(with: value) // replace() returns a completable
          .asObservable()
          .flatMap { () -&gt; Single&lt;SomeType&gt; in
              return Single.just(value)
      }
  }
  </code></pre>
  
  <p>Error on line 4 (flatMap):</p>
  
  <blockquote>
    <p>Cannot convert call result type 'Observable&lt;_.E>' to expected type 'PrimitiveSequence&lt; SingleTrait, SomeType >' (aka 'PrimitiveSequence&lt; SingleTrait, SomeType >')</p>
  </blockquote>
  
  <p>How can I map this completable to a single?</p>