|
|
|
@ -28,3 +28,15 @@ useCost (Recipe _ _ _ uses) totalCost = totalCost / uses
|
|
|
|
|
|
|
|
|
|
(→) :: Ingredient -> Double -> UsedIngredient
|
|
|
|
|
(→) ingredient qtt = UsedIngredient ingredient qtt
|
|
|
|
|
|
|
|
|
|
-- * Presentation
|
|
|
|
|
printRecipeCost :: Recipe -> IO ()
|
|
|
|
|
printRecipeCost recipe = do
|
|
|
|
|
putStrLn $ "* " ++ recipeName recipe ++" :"
|
|
|
|
|
print recipe
|
|
|
|
|
let recipeTotalCost = recipeCost recipe
|
|
|
|
|
recipeUnitCost = unitCost recipe recipeTotalCost
|
|
|
|
|
recipeUseCost = useCost recipe recipeTotalCost
|
|
|
|
|
putStrLn $ " * Prix Total = " ++ show recipeTotalCost ++ "€"
|
|
|
|
|
putStrLn $ " * Prix à l'unité = " ++ show recipeUnitCost ++ "€"
|
|
|
|
|
putStrLn $ " * Prix par utilisation = " ++ show recipeUseCost ++ "€"
|
|
|
|
|