Skip to content

Instantly share code, notes, and snippets.

@aerphanas
Created July 13, 2021 08:14
Show Gist options
  • Select an option

  • Save aerphanas/17780b61e3b6cc7994970a90b1339dc0 to your computer and use it in GitHub Desktop.

Select an option

Save aerphanas/17780b61e3b6cc7994970a90b1339dc0 to your computer and use it in GitHub Desktop.
get bmi on haskell kg and cm
bmi :: (RealFloat a) => a -> a -> String
bmi weight height
| weight / (height / 100)^2 <= 18.5 = "You're underweight, you emo, you!"
| weight / (height / 100)^2 <= 25.0 = "You're supposedly normal. Pffft, I bet you're ugly!"
| weight / (height / 100)^2 <= 30.0 = "You're fat! Lose some weight, fatty!"
| otherwise = "You're a whale, congratulations!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment