aboutsummaryrefslogtreecommitdiff
path: root/src/Indicator.purs
blob: 751c069570a551a94f6ee408f4b9c5c2bcb44690 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
module Indicator
  ( Indicator(..)
  , className
  , fromGlycemicLoad
  ) where

import Prelude

data Indicator = Good | Medium | Bad

className :: Indicator -> String
className Good = "good"
className Medium = "medium"
className Bad = "bad"

fromGlycemicLoad :: Number -> Indicator
fromGlycemicLoad n
  | n <= 10.0 = Good
  | n < 20.0 = Medium
  | otherwise = Bad