diff options
author | Joey Hess <joeyh@joeyh.name> | 2017-04-18 13:04:16 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2017-04-18 13:05:02 -0400 |
commit | 1d18dcbe796820b30e0c8c1db241da95ee7566cb (patch) | |
tree | 4fdb379854ca7027744a3dca5620f7143c913575 /Graphviz.hs | |
parent | b936e6f9df8364701eefd59720c9d85afea5e7e1 (diff) | |
download | debug-me-1d18dcbe796820b30e0c8c1db241da95ee7566cb.tar.gz |
improve types
Including adding a timestamp to logs
Diffstat (limited to 'Graphviz.hs')
-rw-r--r-- | Graphviz.hs | 43 |
1 files changed, 25 insertions, 18 deletions
diff --git a/Graphviz.hs b/Graphviz.hs index 9d508c8..c6ce8a9 100644 --- a/Graphviz.hs +++ b/Graphviz.hs @@ -50,29 +50,36 @@ genGraph opts ls = digraph (Str "debug-me") $ do forM_ ls $ showactivity [ xcolor Green ] where - showactivity s (ActivitySeen { activitySeen = (a, h) }) = do - node (display h) $ s ++ - [ textLabel $ prettyDisplay $ activity a - , shape BoxShape - ] - case activity a of - Rejected ar -> do - let hr = hash ar - let rejstyle = - [ xcolor Red - , Style [dashed, filled] - ] - showactivity rejstyle $ - ActivityEntered (ar, hr) - link hr h rejstyle - _ -> return () - linkprev s a h - showactivity s (ActivityEntered { activityEntered = (a, h) }) = do + showactivity s l = case loggedActivity l of + ActivitySeen a -> do + node (display h) $ s ++ + [ textLabel $ prettyDisplay $ activity a + , shape BoxShape + ] + case activity a of + Rejected ar -> do + let hr = hash ar + let rejstyle = + [ xcolor Red + , Style [dashed, filled] + ] + showactivity rejstyle $ + ActivityLog + { loggedActivity = ActivityEntered ar + , loggedHash = hr + , loggedTimestamp = loggedTimestamp l + } + link hr h rejstyle + _ -> return () + linkprev s a h + ActivityEntered a -> do node (display h) $ s ++ [ textLabel $ prettyDisplay $ activity a , shape Circle ] linkprev s a h + where + h = loggedHash l linkprev s a h = case prevActivity a of Nothing -> return () Just p -> link p h s |