summaryrefslogtreecommitdiff
path: root/src/Main.lhs
diff options
context:
space:
mode:
authorLars-Dominik Braun <lars@6xq.net>2015-06-28 16:42:19 +0200
committerLars-Dominik Braun <lars@6xq.net>2015-06-28 16:42:19 +0200
commit4c6c1bcf877017df98d4a5492a665eca12b8ba98 (patch)
treef5743e9965aac4d71ad3bd54c9ddb2ea8cd3495d /src/Main.lhs
parent87cccdd0d3159c8ac6730cb18dccb166653c58c5 (diff)
downloadpesto-4c6c1bcf877017df98d4a5492a665eca12b8ba98.tar.gz
pesto-4c6c1bcf877017df98d4a5492a665eca12b8ba98.tar.bz2
pesto-4c6c1bcf877017df98d4a5492a665eca12b8ba98.zip
Replace file magic with directives
Adds the %pesto and %bonappetit directives, switches to stream-based operation.
Diffstat (limited to 'src/Main.lhs')
-rw-r--r--src/Main.lhs9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/Main.lhs b/src/Main.lhs
index 5b37b8e..00123d5 100644
--- a/src/Main.lhs
+++ b/src/Main.lhs
@@ -4,8 +4,8 @@ User interface
.. class:: nodoc
> module Main (main) where
-> import Codec.Pesto.Parse (parse, Recipe(..))
-> import Codec.Pesto.Graph (toGraph, firstNodeId, resolveReferences)
+> import Codec.Pesto.Parse (parse)
+> import Codec.Pesto.Graph (extract, toGraph, firstNodeId, resolveReferences)
> import Codec.Pesto.Lint (lint)
> import Codec.Pesto.Dot (toDot)
@@ -23,9 +23,10 @@ add linting information to graph
> main = do
> s <- getContents
-> (flip . either) malformedRecipe (parse s) $ \doc -> do
+> (flip . either) malformedRecipe (parse s) $ \stream -> do
> let
-> nodes = (zip [firstNodeId..] . snd . unzip . operations) doc
+> doc = (head . extract . snd . unzip) stream
+> nodes = zip [firstNodeId..] doc
> edges = toGraph nodes ++ resolveReferences nodes
> --print $ lint nodes edges
> putStrLn $ toDot nodes edges