Copyright | Guillaume Sabbagh 2021 |
---|---|
License | GPL-3 |
Maintainer | guillaumesabbagh@protonmail.com |
Stability | experimental |
Portability | portable |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
A parser to read .cg files.
A .cg file follows the following rules : 1. Each line defines either an object, a morphism or a composition law entry. 2. The following strings are reserved : ' -','-> ',' = ' 3. To define an object, write a line containing its name. 4. To define an arrow, the syntax "source_object -name_of_morphism-> target_object" is used, where "source_object", "target_object" and "name_of_morphism" should be replaced. 4.1. If an object mentionned does not exist, it is created. 4.2. The spaces are important. 5. To define a composition law entry, the syntax "source_object1 -name_of_first_morphism-> middle_object -name_of_second_morphism-> target_object1 = source_object2 -name_of_composite_morphism-> target_object2" is used, where "source_object1", "name_of_first_morphism", "middle_object", "name_of_second_morphism", "target_object1", "source_object2", "name_of_composite_morphism", "target_object2" should be replaced. 5.1 If an object mentionned does not exist, it is created. 5.2 If a morphism mentionned does not exist, it is created. 5.3 You can use the tag ID/ in order to map a morphism to an identity.
Synopsis
- readCGFile :: String -> IO CG
- writeCGFile :: (PrettyPrintable a, PrettyPrintable b, Eq a, Eq b) => CompositionGraph a b -> String -> IO ()
Documentation
readCGFile :: String -> IO CG Source #
Reads a cg file and returns a composition graph.
writeCGFile :: (PrettyPrintable a, PrettyPrintable b, Eq a, Eq b) => CompositionGraph a b -> String -> IO () Source #
Saves a composition graph into a file located at a given path.