mirror of
https://github.com/rgleichman/glance.git
synced 2024-09-11 15:05:41 +03:00
Use SyntaxGraph constructors in TranslateCore.
This commit is contained in:
parent
5c399b9e50
commit
631a7a20d1
@ -89,6 +89,12 @@ syntaxGraphFromNodesEdges icons edges = SyntaxGraph icons edges mempty mempty me
|
|||||||
bindsToSyntaxGraph :: [SgBind] -> SyntaxGraph
|
bindsToSyntaxGraph :: [SgBind] -> SyntaxGraph
|
||||||
bindsToSyntaxGraph binds = SyntaxGraph mempty mempty mempty binds mempty
|
bindsToSyntaxGraph binds = SyntaxGraph mempty mempty mempty binds mempty
|
||||||
|
|
||||||
|
sinksToSyntaxGraph :: [SgSink] -> SyntaxGraph
|
||||||
|
sinksToSyntaxGraph sinks = SyntaxGraph mempty mempty sinks mempty mempty
|
||||||
|
|
||||||
|
edgesToSyntaxGraph :: [Edge] -> SyntaxGraph
|
||||||
|
edgesToSyntaxGraph edges = SyntaxGraph mempty edges mempty mempty mempty
|
||||||
|
|
||||||
-- TODO Remove string parameter
|
-- TODO Remove string parameter
|
||||||
getUniqueName :: String -> State IDState NodeName
|
getUniqueName :: String -> State IDState NodeName
|
||||||
getUniqueName _ = fmap NodeName getId
|
getUniqueName _ = fmap NodeName getId
|
||||||
@ -102,9 +108,9 @@ edgesForRefPortList inPattern portExpPairs = mconcat $ fmap makeGraph portExpPai
|
|||||||
edgeOpts = if inPattern then [EdgeInPattern] else []
|
edgeOpts = if inPattern then [EdgeInPattern] else []
|
||||||
makeGraph (ref, port) = case ref of
|
makeGraph (ref, port) = case ref of
|
||||||
Left str -> if inPattern
|
Left str -> if inPattern
|
||||||
then SyntaxGraph mempty mempty mempty [SgBind str (Right port)] mempty
|
then bindsToSyntaxGraph [SgBind str (Right port)]
|
||||||
else SyntaxGraph mempty mempty [SgSink str port] mempty mempty
|
else sinksToSyntaxGraph [SgSink str port]
|
||||||
Right resultPort -> SyntaxGraph mempty [Edge edgeOpts noEnds connection] mempty mempty mempty where
|
Right resultPort -> edgesToSyntaxGraph [Edge edgeOpts noEnds connection] where
|
||||||
connection = if inPattern
|
connection = if inPattern
|
||||||
-- If in a pattern, then the port on the case icon is the data source.
|
-- If in a pattern, then the port on the case icon is the data source.
|
||||||
then (port, resultPort)
|
then (port, resultPort)
|
||||||
@ -115,9 +121,9 @@ combineExpressions inPattern portExpPairs = mconcat $ fmap makeGraph portExpPair
|
|||||||
edgeOpts = if inPattern then [EdgeInPattern] else []
|
edgeOpts = if inPattern then [EdgeInPattern] else []
|
||||||
makeGraph ((graph, ref), port) = graph <> case ref of
|
makeGraph ((graph, ref), port) = graph <> case ref of
|
||||||
Left str -> if inPattern
|
Left str -> if inPattern
|
||||||
then SyntaxGraph mempty mempty mempty [SgBind str (Right port)] mempty
|
then bindsToSyntaxGraph [SgBind str (Right port)]
|
||||||
else SyntaxGraph mempty mempty [SgSink str port] mempty mempty
|
else sinksToSyntaxGraph [SgSink str port]
|
||||||
Right resultPort -> SyntaxGraph mempty [Edge edgeOpts noEnds (resultPort, port)] mempty mempty mempty
|
Right resultPort -> edgesToSyntaxGraph [Edge edgeOpts noEnds (resultPort, port)]
|
||||||
|
|
||||||
-- qualifyNameAndPort :: String -> NameAndPort -> NameAndPort
|
-- qualifyNameAndPort :: String -> NameAndPort -> NameAndPort
|
||||||
-- qualifyNameAndPort s (NameAndPort n p) = NameAndPort (s DIA..> n) p
|
-- qualifyNameAndPort s (NameAndPort n p) = NameAndPort (s DIA..> n) p
|
||||||
|
Loading…
Reference in New Issue
Block a user