From f2a73374e76e5da8ce893cae0cff6ab21209b152 Mon Sep 17 00:00:00 2001 From: Lars-Dominik Braun Date: Sat, 1 Aug 2015 11:13:38 +0200 Subject: Rework metadata Simplify syntax (no leading dot), only pulled from root node, add extraction function. --- src/Codec/Pesto/Graph.lhs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src/Codec/Pesto/Graph.lhs') diff --git a/src/Codec/Pesto/Graph.lhs b/src/Codec/Pesto/Graph.lhs index c8d17ef..3d28390 100644 --- a/src/Codec/Pesto/Graph.lhs +++ b/src/Codec/Pesto/Graph.lhs @@ -14,10 +14,15 @@ Language semantics > , resolveReferences > , test > , extract +> , NodeId +> , Node +> , Nodes +> , Edge +> , Edges > ) where > import Data.Char (isSpace, toLower, isLetter) > import Data.List (sort, nub) -> import Test.HUnit hiding (test) +> import Test.HUnit hiding (test, Node) > import Control.Applicative ((<$>)) > > import Codec.Pesto.Parse hiding (test) @@ -240,7 +245,12 @@ Appendix > cmpGraph = runGraphWith toGraph > cmpGraphRef = runGraphWith resolveReferences -> firstNodeId = 0 :: Int +> type NodeId = Int +> type Node a = (NodeId, a) +> type Nodes a = [Node a] +> type Edge = (NodeId, NodeId) +> type Edges = [Edge] +> firstNodeId = 0 :: NodeId Find graph’s root node(s), that is a node without outgoing edges: -- cgit v1.2.3