From daf79506ba6ac9fa6b795ad2a19684288b367a92 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 17 Apr 2017 12:07:02 -0400 Subject: add Rejected and tag hashes by type Need a way for the user to indicate when an Activity Entered is Rejected. Changed hashing to include type tags, so Acticity Entered and Activity Seen can never hash to the same hash. Got debug-me.hs to compile after these changes, but currently it's buggy after Activity Entered is Rejected. Started protocol.txt documentation. This commit was sponsored by Francois Marier on Patreon. --- Graphviz.hs | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'Graphviz.hs') diff --git a/Graphviz.hs b/Graphviz.hs index 81ff71a..0809468 100644 --- a/Graphviz.hs +++ b/Graphviz.hs @@ -47,18 +47,16 @@ genGraph ls = digraph (Str "debug-me") $ do forM_ ls $ \l -> case l of ActivitySeen { activitySeen = (a, h) } -> do node (display h) - [ textLabel $ display $ seenData $ activity a - , shape Circle + [ textLabel $ display $ activity a + , shape BoxShape , xcolor Green ] chain a h ActivityEntered { activityEntered = (a, h) } -> do node (display h) - [ textLabel $ display $ enteredData $ activity a - , shape Square - , if activityEnteredAccepted l - then xcolor Green - else xcolor Red + [ textLabel $ display $ activity a + , shape Circle + , xcolor Green ] chain a h where @@ -77,3 +75,13 @@ instance Display Val where instance Display Hash where display (Hash m h) = T.pack (show m) <> display h + +instance Display Seen where + display = display . seenData + +instance Display Entered where + display = display . enteredData + +instance Display a => Display (Proto a) where + display (Proto a) = display a + display (Rejected a) = "Rejected " <> display (activity a) -- cgit v1.2.3