diff options
author | Joris | 2017-04-05 21:26:31 +0200 |
---|---|---|
committer | Joris | 2017-04-05 21:26:35 +0200 |
commit | 28d595fef6d96557c3d318bc63e716dcebba282d (patch) | |
tree | 6ece538d3c6094f72cc7f63f1cef3288adb5ad35 /src/Indicator.purs | |
parent | 82f5793b57e923be50e53b6845802fdd30ef947b (diff) |
Add glycemic index indicator
Diffstat (limited to 'src/Indicator.purs')
-rw-r--r-- | src/Indicator.purs | 19 |
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 |