Created
December 30, 2014 05:01
-
-
Save esttorhe/19d485ae19956aafabc6 to your computer and use it in GitHub Desktop.
`where` expressions in `Haskell` fails if 2nd one has more than one `tab`
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- This compiles | |
bmiTell :: Double -> Double -> String | |
bmiTell weight height | |
| bmi <= skinny = "You are underweight. Eat more! " | |
| bmi <= normal = "Looking good!! " | |
| bmi <= fat = "You are a little fat. Start eating better." | |
| otherwise = "You are obese. Go see a doctor!." | |
where bmi = weight / height ^ 2 | |
skinny = 18.5 | |
normal = 25.0 | |
fat = 30.0 | |
-- This fails | |
bmiTell' :: Double -> Double -> String | |
bmiTell' weight height | |
| bmi <= skinny = "You are underweight. Eat more! " | |
| bmi <= normal = "Looking good!! " | |
| bmi <= fat = "You are a little fat. Start eating better." | |
| otherwise = "You are obese. Go see a doctor!." | |
where bmi = weight / height ^ 2 | |
skinny = 18.5 | |
normal = 25.0 | |
fat = 30.0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Pasting the code as a

gist
makes the alignment issue pretty evident but on sublime it looks exactly the same: