4 ms·
Using the y combinator outside of some ridiculously abstract code would be irritating. Using (>>=) makes sense sometimes though. For instance if you just wanted
by maxiepoo 13y ago
Using the y combinator outside of some ridiculously abstract code would be irritating. Using (>>=) makes sense sometimes though. For instance if you just wanted to echo something you could do
do stuff <- getLine
putStrLn stuff
but the stuff variable is then unnecessarily introduced. You could instead just write
getLine >>= putStrLn
or the flipped version if you want it to read more like function application
putStrLn =<< getLine
- deleted 13y ago[deleted]
- logicallee 13y agohow do neither of you get the obvious joke OP is making with "I think there's definitely a rule against dismissing Y combinators on news.ycombinator.com". (he's making a joke out of the fact that YCombinator is named after the construct.)