summaryrefslogtreecommitdiff
path: root/src/GF/Speech/Graph.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/GF/Speech/Graph.hs')
-rw-r--r--src/GF/Speech/Graph.hs7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/GF/Speech/Graph.hs b/src/GF/Speech/Graph.hs
index 2f80ef0ca..7ebecdc34 100644
--- a/src/GF/Speech/Graph.hs
+++ b/src/GF/Speech/Graph.hs
@@ -13,7 +13,7 @@
-----------------------------------------------------------------------------
module GF.Speech.Graph ( Graph(..), Node, Edge, Incoming, Outgoing
, newGraph, nodes, edges
- , nmap, emap, newNode, newEdge, newEdges
+ , nmap, emap, newNode, newNodes, newEdge, newEdges
, incoming, outgoing, getOutgoing
, getFrom, getTo, getLabel
, reverseGraph, renameNodes
@@ -52,6 +52,11 @@ emap f (Graph c ns es) = Graph c ns [(x,y,f l) | (x,y,l) <- es]
newNode :: a -> Graph n a b -> (Graph n a b,n)
newNode l (Graph (c:cs) ns es) = (Graph cs ((c,l):ns) es, c)
+newNodes :: [a] -> Graph n a b -> (Graph n a b,[Node n a])
+newNodes ls (Graph cs ns es) = (Graph cs' (ns'++ns) es, ns')
+ where (xs,cs') = splitAt (length ls) cs
+ ns' = zip xs ls
+
newEdge :: Edge n b -> Graph n a b -> Graph n a b
newEdge e (Graph c ns es) = Graph c ns (e:es)