aboutsummaryrefslogtreecommitdiff
path: root/src/Food.purs
blob: 19b667cf915a4f19c058f38610e8daa86d0ffac4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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 }
  ]