News for hackers. Stuff that matters.
Re:IO Monad Considered Harmful by exDM69 on Friday January 23, 2015 @03:25AM (#8933909)
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.

There are no comments on this comment yet.