I feel like I should already know this, but how could I use fromMaybe
in one line instead of breaking it into 2 with a let
?
main = do
maybePort <- lookupEnv "PORT"
let port = fromMaybe "4020" maybePort
putStrLn $ "Listening on:" ++ port
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.