aboutsummaryrefslogtreecommitdiff
path: root/src/Indicator.purs
diff options
context:
space:
mode:
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