     }
   }
 
+  /// Replace all emitted elements with the given element.
+  public func replace<T>(with element: T) -> Signal<T, Error> {
+    return map { _ in element }
+  }
+
   /// Map elements to Void.
   public func eraseType() -> Signal<Void, Error> {
     return map { _ in }

  /// Batch each `size` elements into another signal.
  public func window(size: Int) -> Signal<Signal<Element, Error>, Error> {
    return buffer(size: size).map { Signal.sequence($0) }
  }
}


      }
    }
  }

  /// Wrap events into elements.
  public func materialize() -> Signal<Event<Element, Error>, NoError> {
    return Signal { observer in
      return self.observe { event in
        switch event {
        case .next(let element):
          observer.next(.next(element))
        case .failed(let error):
          observer.next(.failed(error))
          observer.completed()
        case .completed:
          observer.next(.completed)
          observer.completed()
        }
      }
    }
  }
}

// MARK: Injections
