diff options
Diffstat (limited to 'debug-me.hs')
-rw-r--r-- | debug-me.hs | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/debug-me.hs b/debug-me.hs index 9332270..7a9f527 100644 --- a/debug-me.hs +++ b/debug-me.hs @@ -278,19 +278,26 @@ sendPtyInput ichan ochan p backlog logger = go go -- | Truncate the Backlog to remove entries older than the one --- that the Activity refers to. +-- that the Activity Entered refers to, but only if the referred +-- to Activity is an Activity Seen. -- --- If the activity refers to an item not in the backlog, no truncation is +-- Once the developer has referred to a given Activity Seen in +-- their Activity Entered, they cannot refer backwards to anything +-- that came before it. +-- +-- If the Activity refers to an item not in the backlog, no truncation is -- done. truncateBacklog :: Backlog -> Activity Entered -> Backlog truncateBacklog (Backlog (b :| l)) (Activity _ hp _) - | Just (activityLogHash b) == hp = Backlog (b :| []) + | truncationpoint b = Backlog (b :| []) | otherwise = Backlog (b :| go [] l) where go c [] = reverse c go c (x:xs) - | Just (activityLogHash x) == hp = reverse (x:c) + | truncationpoint x = reverse (x:c) | otherwise = go (x:c) xs + truncationpoint x@(ActivitySeen {}) = Just (activityLogHash x) == hp + truncationpoint _ = False -- | Entered activity is legal when it points to the last Seen activvity, -- because this guarantees that the person who entered it saw |