diff options
Diffstat (limited to 'src/exe')
-rw-r--r-- | src/exe/Main.lhs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/exe/Main.lhs b/src/exe/Main.lhs index dc360fd..ae663ad 100644 --- a/src/exe/Main.lhs +++ b/src/exe/Main.lhs @@ -8,7 +8,7 @@ User interface > import Data.List (intercalate) > > import Codec.Pesto.Parse (parse, Instruction (Ingredient), Quantity (..)) -> import Codec.Pesto.Graph (extract, toGraph, firstNodeId, resolveReferences) +> import Codec.Pesto.Graph (extract, toGraph, firstNodeId, resolveReferences, extractIngredients, mergeQuantity) > import Codec.Pesto.Lint (lint, extractMetadata, Metadata(..), LintResult (LintResult)) > import Codec.Pesto.Serialize (serialize) @@ -87,10 +87,10 @@ ingredients Extract ingredients and print them in CSV format. This does not take alternatives into account yet. -> runIngredients stream = mapM_ (putStrLn . csvQty) $ reverse $ foldl getIngredient [] stream +> runIngredients stream = mapM_ (putStrLn . csvQty) $ ingredients > where -> getIngredient xs (_, Ingredient q) = q:xs -> getIngredient xs _ = xs +> (nodes, _) = streamToGraph stream +> ingredients = mergeQuantity $ extractIngredients nodes > printMeta (_, (key, MetaStr value)) = putStrLn $ key ++ "=" ++ value > printMeta (_, (key, MetaQty q)) = putStrLn $ key ++ "=" ++ csvQty q |