3 ms·
First three lines could just be written using applicatives only: (+) <$> readLn <> readLn The monadic part only comes into play in the last line: (+) <$> rea
by pdpi 11y ago
First three lines could just be written using applicatives only:
(+) <$> readLn <> readLn
The monadic part only comes into play in the last line:
(+) <$> readLn <> readLn >>= print
It's part of what makes it monadic that the action takes an argument.
- tel 11y agoIt's really the add function, strangely, which is monadic here. Or the whole thing is an applicative if you take at face value his claim that add is pure.