summaryrefslogtreecommitdiff
path: root/src/Codec/Pesto/Graph.lhs
diff options
context:
space:
mode:
authorLars-Dominik Braun <lars@6xq.net>2015-08-01 11:13:38 +0200
committerLars-Dominik Braun <lars@6xq.net>2015-08-01 11:14:35 +0200
commitf2a73374e76e5da8ce893cae0cff6ab21209b152 (patch)
treea3203a9cdb450ff594721927766c13cbad95d3b8 /src/Codec/Pesto/Graph.lhs
parent88e2760d9964b84ea6f9959df693181448680c2d (diff)
downloadpesto-f2a73374e76e5da8ce893cae0cff6ab21209b152.tar.gz
pesto-f2a73374e76e5da8ce893cae0cff6ab21209b152.tar.bz2
pesto-f2a73374e76e5da8ce893cae0cff6ab21209b152.zip
Rework metadata
Simplify syntax (no leading dot), only pulled from root node, add extraction function.
Diffstat (limited to 'src/Codec/Pesto/Graph.lhs')
-rw-r--r--src/Codec/Pesto/Graph.lhs14
1 files changed, 12 insertions, 2 deletions
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: