Skip to content

Instantly share code, notes, and snippets.

@jamiepinkham
Last active February 1, 2019 20:29
Show Gist options
  • Save jamiepinkham/7271febc382bc591bcd3c656fdd54f31 to your computer and use it in GitHub Desktop.
Save jamiepinkham/7271febc382bc591bcd3c656fdd54f31 to your computer and use it in GitHub Desktop.
protocol Action { }
protocol State {
static var initial: Self { get }
}
typealias Reducer<S: State, A: Action> = (_ state: S, _ action: A) -> S
enum AnAction: Action { }
enum AState: State {
case none
case error(Error)
static let initial: AState = .none
}
let reducer: Reducer<AState, AnAction> = { (state, action) in switch (state, action) {} }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment