From ef877b46111667bf786f95e821445beeb966f939 Mon Sep 17 00:00:00 2001 From: Yves Dubromelle Date: Sat, 21 May 2016 02:27:20 +0200 Subject: [PATCH] sectioning --- cout-recette.hs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cout-recette.hs b/cout-recette.hs index 83dcf32..693ae7a 100755 --- a/cout-recette.hs +++ b/cout-recette.hs @@ -1,5 +1,6 @@ #! /usr/bin/env runhaskell +-- * Data types definition data Ingredient = Ingredient { ingredientName :: String , unit_cost :: Double }deriving (Show) @@ -12,6 +13,7 @@ data Recipe = Recipe { recipeName :: String , useNumber :: Double }deriving (Show) +-- * Calculations recipeCost :: Recipe -> Double recipeCost (Recipe _ bom _ _) = sum . map ingredientCost $ bom @@ -27,6 +29,7 @@ useCost (Recipe _ _ _ uses) totalCost = totalCost / uses (→) :: Ingredient -> Double -> UsedIngredient (→) ingredient qtt = UsedIngredient ingredient qtt +-- * Example (in french for now) eau = Ingredient "Eau" 0.003 savonMarseille = Ingredient "Savon de Marseille" 3.36 bicarbonate = Ingredient "Bicarbonate de soude" 3.81