From 4c6c1bcf877017df98d4a5492a665eca12b8ba98 Mon Sep 17 00:00:00 2001 From: Lars-Dominik Braun Date: Sun, 28 Jun 2015 16:42:19 +0200 Subject: Replace file magic with directives Adds the %pesto and %bonappetit directives, switches to stream-based operation. --- src/Main.lhs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/Main.lhs') 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 -- cgit v1.2.3