File tree 1 file changed +8
-7
lines changed
1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -169,13 +169,14 @@ module App =
169
169
|> Func.dedup
170
170
|> RoseTree.mapChildren
171
171
172
- let update = function
173
- | ToggleGlobalState -> not |> SomeGlobalState.map
174
- | CounterMsg ( nId, msg) -> msg |> Counter.update |> Identifiable.mapIfId nId |> RoseTree.mapData |> DummyRoot.map
175
- | AddCounter pId -> () |> Guid.NewGuid |> addChildCounter |> mapIf ( hasId pId) |> RoseTree.map |> DummyRoot.map
176
- | Remove nId -> nId |> hasId >> not |> List.filter |> RoseTree.mapChildren |> RoseTree.map |> DummyRoot.map
177
- | MoveUp nId -> nId |> swapCounters List.swapWithPrev |> RoseTree.map |> DummyRoot.map
178
- | MoveDown nId -> nId |> swapCounters List.swapWithNext |> RoseTree.map |> DummyRoot.map
172
+ let update msg m =
173
+ match msg with
174
+ | ToggleGlobalState -> { m with SomeGlobalState = not m.SomeGlobalState }
175
+ | CounterMsg ( nId, msg) -> { m with DummyRoot = ( msg |> Counter.update |> Identifiable.mapIfId nId |> RoseTree.mapData) m.DummyRoot }
176
+ | AddCounter pId -> { m with DummyRoot = ( Guid.NewGuid () |> addChildCounter |> mapIf ( hasId pId) |> RoseTree.map) m.DummyRoot }
177
+ | Remove nId -> { m with DummyRoot = ( nId |> hasId >> not |> List.filter |> RoseTree.mapChildren |> RoseTree.map) m.DummyRoot }
178
+ | MoveUp nId -> { m with DummyRoot = ( nId |> swapCounters List.swapWithPrev |> RoseTree.map) m.DummyRoot }
179
+ | MoveDown nId -> { m with DummyRoot = ( nId |> swapCounters List.swapWithNext |> RoseTree.map) m.DummyRoot }
179
180
180
181
/// Returns all top-level counters.
181
182
let topLevelCounters m =
You can’t perform that action at this time.
0 commit comments