Skip to content

Instantly share code, notes, and snippets.

View ezura's full-sized avatar

Yuka Ezura ezura

View GitHub Profile
@ezura
ezura / typed-error-poem.md
Created November 3, 2017 21:35 — forked from inamiy/typed-error-poem.md
Swift Poem: Why I prefer typed error (for https://github.com/apple/swift-evolution/pull/757)

Typed error can be useful in certain cases, especially when accompanied with NoError type.

For example, in reactive programming, https://github.com/ReactiveCocoa/ReactiveSwift (typed error) allows us to create UI bindings only if Error is NoError, i.e.:

static func <~ <Source: BindingSource> (provider: Self, source: Source) -> Disposable? 
    where Source.Value == Value, Source.Error == NoError { ... }
    
// example
let alphaSignal: Signal = ...