From 28d595fef6d96557c3d318bc63e716dcebba282d Mon Sep 17 00:00:00 2001 From: Joris Date: Wed, 5 Apr 2017 21:26:31 +0200 Subject: Add glycemic index indicator --- src/Indicator.purs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 src/Indicator.purs (limited to 'src/Indicator.purs') 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 -- cgit v1.2.3