Skip to content
This repository was archived by the owner on Apr 1, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Data/Graph.hs
Original file line number Diff line number Diff line change
Expand Up @@ -111,5 +111,5 @@ instance (Ord vertex, ToJSON vertex, VertexTag vertex) => ToJSON (Graph vertex)
newtype Edge vertex = Edge (vertex, vertex)

instance (ToJSON vertex, VertexTag vertex) => ToJSON (Edge vertex) where
toJSON (Edge (a, b)) = object ["source" .= uniqueTag a, "target" .= uniqueTag b]
toEncoding (Edge (a, b)) = pairs ("source" .= uniqueTag a <> "target" .= uniqueTag b)
toJSON (Edge (a, b)) = object ["source" .= show (uniqueTag a), "target" .= show (uniqueTag b)]
toEncoding (Edge (a, b)) = pairs ("source" .= show (uniqueTag a) <> "target" .= show (uniqueTag b))
9 changes: 8 additions & 1 deletion src/Data/Graph/ControlFlowVertex.hs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,14 @@ instance Lower ControlFlowVertex where lowerBound = Package ""
instance VertexTag ControlFlowVertex where uniqueTag = hash . vertexIdentifier

instance ToJSON ControlFlowVertex where
toJSON v = object [ "name" .= vertexIdentifier v, "type" .= vertexToType v ]
toJSON v = object [ "name" .= vertexIdentifier v
, "type" .= vertexToType v
, "id" .= show (uniqueTag v)
]
toEncoding v = pairs $ mconcat [ "name" .= vertexIdentifier v
, "type" .= vertexToType v
, "id" .= show (uniqueTag v)
]

-- TODO: This is potentially valuable just to get name's out of declarable things.
-- Typeclasses to create 'ControlFlowVertex's from 'Term's. Also extracts
Expand Down