module Food ( Aliment , all , glycemicLoad ) where import Data.Int (toNumber) import Prelude type Aliment = { name :: String , glycemicIndex :: Int , carbohydrates :: Int -- for 100 grams } glycemicLoad :: Aliment -> Number glycemicLoad aliment = toNumber aliment.glycemicIndex * toNumber aliment.carbohydrates / 100.0 all :: Array Aliment all = [ { name: "oignons", glycemicIndex: 15, carbohydrates: 9 } , { name: "olives", glycemicIndex: 15, carbohydrates: 6 } , { name: "haricots rouges", glycemicIndex: 35, carbohydrates: 24 } , { name: "haricots blancs", glycemicIndex: 35, carbohydrates: 13 } , { name: "pommes de terres (cuites avec leur peau)", glycemicIndex: 70, carbohydrates: 37 } , { name: "lentilles vertes", glycemicIndex: 30, carbohydrates: 30 } , { name: "lentilles corail", glycemicIndex: 21, carbohydrates: 48 } , { name: "riz basmatti", glycemicIndex: 58, carbohydrates: 25 } ]