aboutsummaryrefslogtreecommitdiff
path: root/src/Indicator.purs
diff options
context:
space:
mode:
authorJoris2017-04-05 21:26:31 +0200
committerJoris2017-04-05 21:26:35 +0200
commit28d595fef6d96557c3d318bc63e716dcebba282d (patch)
tree6ece538d3c6094f72cc7f63f1cef3288adb5ad35 /src/Indicator.purs
parent82f5793b57e923be50e53b6845802fdd30ef947b (diff)
Add glycemic index indicator
Diffstat (limited to 'src/Indicator.purs')
-rw-r--r--src/Indicator.purs19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/Indicator.purs b/src/Indicator.purs
new file mode 100644
index 0000000..536133d
--- /dev/null
+++ b/src/Indicator.purs
@@ -0,0 +1,19 @@
+module Indicator
+ ( Indicator(..)
+ , fromGlycemicIndex
+ ) where
+
+import Prelude
+
+data Indicator = Good | Medium | Bad
+
+instance showIndicator :: Show Indicator where
+ show Good = "Good"
+ show Medium = "Medium"
+ show Bad = "Bad"
+
+fromGlycemicIndex :: Int -> Indicator
+fromGlycemicIndex n
+ | n < 40 = Good
+ | n < 55 = Medium
+ | otherwise = Bad