initial commit (non functional)

master
Yves Dubromelle 9 years ago
parent 8c3494a403
commit 74a832ff24

@ -0,0 +1,34 @@
#! /usr/bin/env runhaskell
type Ingredient = (String, Double, Double)
type Recette = ( String, [Ingredient], Double, Double)
ingredientsLessive :: [Ingredient]
ingredientsLessive = ( "Lessive"
, [ ("Eau", 0.003, 2.5)
, ("Savon de Marseille", 3.36, 0.1)
, ("Bicarbonate de soude", 3.81, 0.016)
, ("Vinaigre blanc", 0.36, 0.03)
]
, 2.5
, 30
)
quantiteLessive = 2.5
nombreUtilisations = 30
prixTotal ingredientsLessive = sum . map (\ (_, x, y) -> x * y) $ ingredientsLessive
prixLitre prixTotal quantiteLessive = prixTotal / quantiteLessive
prixUtilisation prixTotal quantiteLessive = prixTotal / nombreUtilisations
main = do
putStrLn "Calcul du coût des recettes\n"
putStrLn "* Lessive :"
print ingredientsLessive
putStrLn $ " * Prix Total = " ++ show prixTotal ++ ""
putStrLn $ " * Prix au litre = " ++ show prixLitre ++ ""
putStrLn $ " * Prix par utilisation = " ++ show prixUtilisation ++ ""
Loading…
Cancel
Save