( _supervisor: Supervisor.Supervisor<any>, _patches: Chunk.Chunk<SupervisorPatch> )
| 92 | |
| 93 | /** @internal */ |
| 94 | const patchLoop = ( |
| 95 | _supervisor: Supervisor.Supervisor<any>, |
| 96 | _patches: Chunk.Chunk<SupervisorPatch> |
| 97 | ): Supervisor.Supervisor<any> => { |
| 98 | let supervisor = _supervisor |
| 99 | let patches = _patches |
| 100 | while (Chunk.isNonEmpty(patches)) { |
| 101 | const head = Chunk.headNonEmpty(patches) |
| 102 | switch (head._tag) { |
| 103 | case OP_EMPTY: { |
| 104 | patches = Chunk.tailNonEmpty(patches) |
| 105 | break |
| 106 | } |
| 107 | case OP_ADD_SUPERVISOR: { |
| 108 | supervisor = supervisor.zip(head.supervisor) |
| 109 | patches = Chunk.tailNonEmpty(patches) |
| 110 | break |
| 111 | } |
| 112 | case OP_REMOVE_SUPERVISOR: { |
| 113 | supervisor = removeSupervisor(supervisor, head.supervisor) |
| 114 | patches = Chunk.tailNonEmpty(patches) |
| 115 | break |
| 116 | } |
| 117 | case OP_AND_THEN: { |
| 118 | patches = Chunk.prepend(head.first)(Chunk.prepend(head.second)(Chunk.tailNonEmpty(patches))) |
| 119 | break |
| 120 | } |
| 121 | } |
| 122 | } |
| 123 | return supervisor |
| 124 | } |
| 125 | |
| 126 | /** @internal */ |
| 127 | const removeSupervisor = ( |
no test coverage detected