If we wanted to, we could even go a bit overboard and write our function like this:
bmiTell :: Double -> Double -> String bmiTell weight height | bmi <= skinny = "You're underweight, you emo, you!" | bmi <= normal = "You're supposedly normal. Pffft, I bet you're ugly!" | bmi <= fat = "You're fat! Lose some weight, fatty!" | otherwise = "You're a whale, congratulations!" where bmi = weight / height ^ 2 skinny = 18.5 normal = 25.0 fat = 30.0
I don't know if this is overboard, seems like it greatly increases the readability.
Share this highlighthttp://www.safaribooksonline.com/a/learn-you-a/137317/