Safe Haskell | Safe-Inferred |
---|
Diff two states to produce a list of Updates, which must be sent to the UI to make it display the second state.
This is unpleasantly complicated and subtle. I wish I knew a better way!
Synopsis
- run :: DiffM () -> ([Update.UiUpdate], [Update.DisplayUpdate])
- diff :: Update.UiDamage -> Ui.State -> Ui.State -> ([Update.UiUpdate], [Update.DisplayUpdate])
- derive_diff :: Ui.State -> Ui.State -> Update.UiDamage -> [Update.UiUpdate] -> Derive.ScoreDamage
- track_diff :: Ui.State -> Ui.State -> TrackId -> Update.UiDamage
- score_changed :: Ui.State -> Ui.State -> Update.UiDamage -> Bool
- diff_views :: Ui.State -> Ui.State -> Update.UiDamage -> DiffM ()
Documentation
run :: DiffM () -> ([Update.UiUpdate], [Update.DisplayUpdate]) Source #
diff :: Update.UiDamage -> Ui.State -> Ui.State -> ([Update.UiUpdate], [Update.DisplayUpdate]) Source #
Figure out updates needed to turn st1
into st2
.
derive_diff :: Ui.State -> Ui.State -> Update.UiDamage -> [Update.UiUpdate] -> Derive.ScoreDamage Source #
This diff is meant to determine score damage for the block, which determines what will have to be rederived, if anything.
This is repeating some work done in diff
, but is fundamentally different
because it cares about nonvisible changes, e.g. track title change on
a block without a view.
track_diff :: Ui.State -> Ui.State -> TrackId -> Update.UiDamage Source #
Diff the events on one track. This will only emit track damage, and won't
emit anything if the track title changed, or was created or deleted. Those
diffs should be picked up by the main diff
.
score_changed :: Ui.State -> Ui.State -> Update.UiDamage -> Bool Source #
This is like derive_diff
, but it only needs to return a Bool. It's also
more sensitive in that it's looking for any change that you might want to
save to disk, not just changes that could require rederivation.
diff_views :: Ui.State -> Ui.State -> Update.UiDamage -> DiffM () Source #