diff options
author | Lars-Dominik Braun <lars@6xq.net> | 2015-06-14 20:35:08 +0200 |
---|---|---|
committer | Lars-Dominik Braun <lars@6xq.net> | 2015-06-14 20:35:08 +0200 |
commit | e92c82e2c9ff541cd321ad7a8aedcf34e615197c (patch) | |
tree | fd07d24164450f25a224eb593922e4a4926d062b /src/Main.lhs | |
download | pesto-e92c82e2c9ff541cd321ad7a8aedcf34e615197c.tar.gz pesto-e92c82e2c9ff541cd321ad7a8aedcf34e615197c.tar.bz2 pesto-e92c82e2c9ff541cd321ad7a8aedcf34e615197c.zip |
First public version
Diffstat (limited to 'src/Main.lhs')
-rw-r--r-- | src/Main.lhs | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/Main.lhs b/src/Main.lhs new file mode 100644 index 0000000..5b37b8e --- /dev/null +++ b/src/Main.lhs @@ -0,0 +1,34 @@ +User interface +++++++++++++++ + +.. class:: nodoc + +> module Main (main) where +> import Codec.Pesto.Parse (parse, Recipe(..)) +> import Codec.Pesto.Graph (toGraph, firstNodeId, resolveReferences) +> import Codec.Pesto.Lint (lint) +> import Codec.Pesto.Dot (toDot) + +The pesto to dot converter can be run with ``cabal run pesto``. It expects a +pesto recipe on the standard input and prints a dot graph to stdout that can be +converted to an image by piping it through ``dot -Tpng``. Example: + +.. code:: bash + + cabal run --verbose=0 pesto < spaghetti.pesto | dot -Tpng > spaghetti.png + +.. class:: todo + +add linting information to graph + +> main = do +> s <- getContents +> (flip . either) malformedRecipe (parse s) $ \doc -> do +> let +> nodes = (zip [firstNodeId..] . snd . unzip . operations) doc +> edges = toGraph nodes ++ resolveReferences nodes +> --print $ lint nodes edges +> putStrLn $ toDot nodes edges + +> malformedRecipe = print + |