   convenience init(
     initialState: ReduxTypes.StateType,
     reducers: [ReduxTypes.ReduceFunction],
-    middlewares: [(@escaping ReduxTypes.ReduceFunction) -> ReduxTypes
-      .ReduceFunction] = []
+    middlewares: [(@escaping ReduxTypes.ReduceFunction) -> ReduxTypes.ReduceFunction] = []
   ) {
     self.init(initialState: initialState)
 

extension MiddlewareType {
  func apply(_ reduce: @escaping ActionTypeErasedReduceFunction) -> ActionTypeErasedReduceFunction {
    { tuple in
      guard let typedTuple = tuple as? ReduceTuple else {
        return reduce(tuple)
      }

      let typedReduce: (ReduceTuple) -> ActionTypeErasedReduceTuple = { typedTuple in
        // We know that we can cast the typed action to ReduxTypes.ActionType


extension ReducerType {
  func reduce(_ tuple: ActionTypeErasedReduceTuple) -> ActionTypeErasedReduceTuple {
    guard let typedTuple = tuple as? ReduceTuple else { return tuple }

    let typedResult = self.typedReduce(typedTuple)
    return (state: typedResult.state, action: typedResult.action, modified: typedResult.modified)
