aboutsummaryrefslogtreecommitdiff
path: root/src/Indicator.purs
blob: 29daa4f40d8362a579b361e71415235e17878321 (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 <= 8.0 = Good
  | n <= 20.0 = Medium
  | otherwise = Bad