From d3b5060c9f6d2ba4903ea74402811adb96127f4d Mon Sep 17 00:00:00 2001 From: Alan Malloy Date: Wed, 28 Jan 2026 18:19:42 -0800 Subject: [PATCH] Improve documentation for GHC-01239 It talks about using if/then/else as an function argument, but the code snippet just returns it from a function, the same as you could in any language. --- message-index/messages/GHC-01239/index.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/message-index/messages/GHC-01239/index.md b/message-index/messages/GHC-01239/index.md index a8a254bc..d18978ab 100644 --- a/message-index/messages/GHC-01239/index.md +++ b/message-index/messages/GHC-01239/index.md @@ -8,11 +8,13 @@ introduced: 9.6.1 Unlike in many other languages, in Haskell the If-Then-Else construct is an expression, which means it returns a value that can be processed further. ```haskell -ageMessage :: Int -> String -ageMessage age = if age < 18 then "You are too young to enter" else "Welcome to the club" +greetUser :: Int -> IO () +greetUser age = putStrLn (if age < 18 + then "You are too young to enter" + else "Welcome to the club") -putStrLn (ageMessage 10) -- You are too young to enter -putStrLn (ageMessage 20) -- Welcome to the club +greetUser 10 -- You are too young to enter +greetUser 20 -- Welcome to the club ``` Because If-Then-Else expressions return values, it makes sense to pass them as input to a function.