Skip to content

Commit

Permalink
simplified use of OutMsg iva mapMsg
Browse files Browse the repository at this point in the history
  • Loading branch information
Tyson Williams committed Dec 4, 2020
1 parent c534e34 commit a1f30fa
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/Samples/SubModelSeq/Program.fs
Original file line number Diff line number Diff line change
Expand Up @@ -244,13 +244,13 @@ module Bindings =
let moveUpMsg (_, { Parent = p; Self = s }) =
match p.Children |> List.tryHead with
| Some c when c.Data.Id <> s.Data.Id ->
OutMoveUp |> OutMsg |> Some
OutMoveUp |> Some
| _ -> None

let moveDownMsg (_, { Parent = p; Self = s }) =
match p.Children |> List.tryLast with
| Some c when c.Data.Id <> s.Data.Id ->
OutMoveDown |> OutMsg |> Some
OutMoveDown |> Some
| _ -> None

let rec subtreeBindings () : Binding<Model * SelfWithParent<RoseTree<Identifiable<Counter>>>, InOutMsg<RoseTreeMsg<Guid, SubtreeMsg>, SubtreeOutMsg>> list =
Expand All @@ -276,13 +276,12 @@ module Bindings =
|> Bindings.mapMsg InMsg

let outMsgBindings =
[ "Remove" |> Binding.cmd(OutRemove |> OutMsg)
[ "Remove" |> Binding.cmd OutRemove
"MoveUp" |> Binding.cmdIf moveUpMsg
"MoveDown" |> Binding.cmdIf moveDownMsg ]
"MoveDown" |> Binding.cmdIf moveDownMsg
] |> Bindings.mapMsg OutMsg

[ outMsgBindings
inMsgBindings ]
|> List.concat
outMsgBindings @ inMsgBindings


let rootBindings () : Binding<Model, Msg> list = [
Expand Down

0 comments on commit a1f30fa

Please sign in to comment.