diff options
author | Lars-Dominik Braun <lars@6xq.net> | 2023-01-19 14:56:41 +0100 |
---|---|---|
committer | Lars-Dominik Braun <lars@6xq.net> | 2023-01-19 14:56:41 +0100 |
commit | cc2aaa6e46dfac12dfad39414925d5a535a91d19 (patch) | |
tree | a257c2cecf7344263bc9775828fc47689423da2d /src/exe/Main.lhs | |
parent | 623f8efba15e167ebae89618cb5362c3f9486ec0 (diff) | |
download | pesto-master.tar.gz pesto-master.tar.bz2 pesto-master.zip |
Diffstat (limited to 'src/exe/Main.lhs')
-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 |