@@ -280,26 +280,6 @@ extension Effect where Failure == Swift.Error {
280280 }
281281}
282282
283- extension Effect where Output == Never {
284- /// Upcasts an `Effect<Never, Failure>` to an `Effect<T, Failure>` for any type `T`. This is
285- /// possible to do because an `Effect<Never, Failure>` can never produce any values to feed back
286- /// into the store (hence the name "fire and forget"), and therefore we can act like it's an
287- /// effect that produces values of any type (since it never produces values).
288- ///
289- /// This is useful for times you have an `Effect<Never, Failure>` but need to massage it into
290- /// another type in order to return it from a reducer:
291- ///
292- /// case .buttonTapped:
293- /// return analyticsClient.track("Button Tapped")
294- /// .fireAndForget()
295- ///
296- /// - Returns: An effect.
297- public func fireAndForget< T> ( ) -> Effect < T , Failure > {
298- func absurd< A> ( _ never: Never ) -> A { }
299- return self . map ( absurd)
300- }
301- }
302-
303283extension Publisher {
304284 /// Turns any publisher into an `Effect`.
305285 ///
@@ -338,14 +318,20 @@ extension Publisher {
338318 /// and any failure.
339319 ///
340320 /// This is useful for times you want to fire off an effect but don't want to feed any data back
341- /// into the system.
321+ /// into the system. It can automatically promote an effect to your reducer's domain.
342322 ///
343323 /// case .buttonTapped:
344324 /// return analyticsClient.track("Button Tapped")
345325 /// .fireAndForget()
346326 ///
327+ /// - Parameters:
328+ /// - outputType: An output type.
329+ /// - failureType: A failure type.
347330 /// - Returns: An effect that never produces output or errors.
348- public func fireAndForget< NewOutput, NewFailure> ( ) -> Effect < NewOutput , NewFailure > {
331+ public func fireAndForget< NewOutput, NewFailure> (
332+ outputType: NewOutput . Type = NewOutput . self,
333+ failureType: NewFailure . Type = NewFailure . self
334+ ) -> Effect < NewOutput , NewFailure > {
349335 return
350336 self
351337 . flatMap { _ in Empty ( ) }
0 commit comments