3 ms·
You can use "fmap" to make this nicer (but that introduces yet another concept). If you use hlint on the program above, you it will tell you to use fmap instead
by exDM69 12y ago
You can use "fmap" to make this nicer (but that introduces yet another concept). If you use hlint on the program above, you it will tell you to use fmap instead.
fmap ("Hello, " ++) getLine >>= putStrLn
I learned this because hlint suggested it to me. Using hlint is a very good idea, even for beginners.
For a simple "greet" program, this isn't perhaps any neater or cleaner but fmap is a powerful tool with lots of practical uses.