From e92c82e2c9ff541cd321ad7a8aedcf34e615197c Mon Sep 17 00:00:00 2001 From: Lars-Dominik Braun Date: Sun, 14 Jun 2015 20:35:08 +0200 Subject: First public version --- src/Main.lhs | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 src/Main.lhs (limited to 'src/Main.lhs') 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 + -- cgit v1.2.3