Karya, built on 2018-05-31T02:46:59 (patch 0a1a35479c514820d77330ae8a978975ba22a47a)

Safe HaskellNone



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!



diff :: [Update.CmdUpdate] -> Ui.State -> Ui.State -> ([Update.UiUpdate], [Update.DisplayUpdate]) Source #

Emit a list of the necessary Updates to turn st1 into st2.

derive_diff :: Ui.State -> Ui.State -> [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.CmdUpdate] Source #

Diff the events on one track. This will only emit CmdTrackEvents, 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.CmdUpdate] -> 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.