Use unsafePerformIO
import System.IO.Unsafe
bmi weight height = printDebug $ weight / (height / 100)^2
bmiTell :: Double -> Double -> String
bmiTell weight height
| bmi weight height <= skinny = "skinny"
| bmi weight height <= normal = "normal"
| bmi weight height <= fat = "fat"
where skinny = 18.5
normal = 25.0
fat = 30.0
printDebug x = unsafePerformIO $ do
print $ "bmi: " ++ (show x)
return x
main = print $ bmiTell 65.0 171.0
prints:
"bmi: 22.229061933586404"
"bmi: 22.229061933586404"
"normal"