packages feed

pangraph 0.2.0 → 0.2.1

raw patch · 8 files changed

+43/−59 lines, 8 filesdep ~algebraic-graphsdep ~attoparsecdep ~bytestring

Dependency ranges changed: algebraic-graphs, attoparsec, bytestring, containers, fgl, hexml, html-entities, text

Files

pangraph.cabal view
@@ -1,5 +1,5 @@ name:                 pangraph-version:              0.2.0+version:              0.2.1 synopsis:             A set of parsers for graph languages and conversions to                        graph libaries. description:          A package allowing parsing of graph files into graph @@ -17,6 +17,11 @@ category:             Data Structures, Graphs, Parser build-type:           Simple cabal-version:        >=1.10+stability:            experimental+-- Last three major versions+tested-with:          GHC==8.0.2,+                      GHC==8.2.2,+                      GHC==8.4.3  library   hs-source-dirs:     src@@ -27,24 +32,21 @@                    ,  Pangraph.GraphML.Writer                    ,  Pangraph.Internal.XMLTemplate                    ,  Pangraph.Internal.HexmlExtra-                   ,  Pangraph.Examples.Reading-                   ,  Pangraph.Examples.Writing-                   ,  Pangraph.Examples.ToContainersGraph+                   ,  Pangraph.Example                    ,  Pangraph.Examples.SampleGraph                    ,  Pangraph.Internal.ProtoGraph-                   ,  Pangraph.Examples.Gml                    ,  Pangraph.Gml.Ast                    ,  Pangraph.Gml.Parser                    ,  Pangraph.Gml.Writer   build-depends:      base >= 4.8 && < 5-                   ,  bytestring-                   ,  hexml-                   ,  containers-                   ,  algebraic-graphs-                   ,  fgl-                   ,  attoparsec-                   ,  text-                   ,  html-entities+                   ,  algebraic-graphs    == 0.2.*+                   ,  attoparsec          == 0.13.*+                   ,  bytestring          == 0.10.*+                   ,  containers          == 0.5.*+                   ,  fgl                 == 5.6.*+                   ,  hexml               == 0.3.*+                   ,  html-entities       == 1.1.*+                   ,  text                == 1.2.*   default-language:   Haskell2010   GHC-options:        -Wall -fwarn-tabs @@ -62,7 +64,7 @@                    ,  containers                    ,  bytestring                    ,  HUnit-                   ,  pangraph+                   ,  pangraph    default-language:   Haskell2010   GHC-options:        -Wall -fwarn-tabs -fbreak-on-exception 
src/Pangraph.hs view
@@ -29,7 +29,8 @@ import Data.Map.Strict       (Map) import qualified Data.Map.Strict  as Map import qualified Data.ByteString  as BS-import qualified Algebra.Graph.Class as Alga+import qualified Algebra.Graph.ToGraph as Alga+import qualified Algebra.Graph as Alga  -- | The 'Pangraph' type is the core intermediate type between abstract representations of graphs. data Pangraph = Pangraph
+ src/Pangraph/Example.hs view
@@ -0,0 +1,24 @@+module Pangraph.Example where++import Pangraph.Examples.SampleGraph(smallGraph)++import qualified Pangraph.GraphML.Parser as GraphML+import qualified Pangraph.GraphML.Writer as GraphML++import qualified Pangraph.Gml.Parser as Gml+import qualified Pangraph.Gml.Writer as Gml++import qualified Pangraph.Containers as Containers++main :: IO ()+main = do +    -- Serialise and re-parse the graph in to GraphML.+    let Just gGraphML = (GraphML.parse . GraphML.write) smallGraph+    -- Test equality+    print $ "GraphML reflectivity: " ++ show (gGraphML == smallGraph)+    +    -- Serialise and re-parse the graph into Gml+    let Just gGml = (Gml.parse . Gml.write) smallGraph+    print $ "Gml reflectivity: " ++ show (gGml == smallGraph)+    -- Print the result of the Containers conversion+    print $ ((\(a,_,_) -> a) . Containers.convert) smallGraph
− src/Pangraph/Examples/Gml.hs
@@ -1,13 +0,0 @@-module Pangraph.Examples.Gml where--import Prelude hiding (readFile)--import Data.ByteString (readFile)--import qualified Pangraph.Gml.Parser as Gml--main :: IO ()-main = do-  fileName <- getLine-  file <- readFile fileName-  print (Gml.parse file)
− src/Pangraph/Examples/Reading.hs
@@ -1,13 +0,0 @@-module Pangraph.Examples.Reading where--import Prelude hiding (readFile)--import Data.ByteString (readFile)--import qualified Pangraph.GraphML.Parser as GraphML--main :: IO ()-main = do-  fileName <- getLine-  file <- readFile fileName-  print (GraphML.parse file)
− src/Pangraph/Examples/ToContainersGraph.hs
@@ -1,9 +0,0 @@-module Pangraph.Examples.ToContainersGraph where--import Pangraph.Containers(convert)-import Pangraph.Examples.SampleGraph(smallGraph)--main :: IO ()-main =-  -- Transform to Containers Data.Graph and print.-  print $ ((\(a,_,_) -> a) . convert) smallGraph
− src/Pangraph/Examples/Writing.hs
@@ -1,8 +0,0 @@-module Pangraph.Examples.Writing where--import Pangraph.GraphML.Writer(write)-import Pangraph.Examples.SampleGraph(smallGraph)--main :: IO ()-main =-  print $ write smallGraph
test/Gml.hs view
@@ -19,7 +19,7 @@ testGmlParse = let     file = "graph [node [id 1 label \"Hello\"] node [id 2] edge [source 1 target 2]]"     graph = Just (Object [("graph", Object [-                ("node", Object [("id", Integer 1), ("label", String "Hello")]), +                ("node", Object [("id", Integer 1), ("label", String "Hello")]),                 ("node", Object [("id", Integer 2)]),                 ("edge", Object [("source", Integer 1),                     ("target", Integer 2)])])])