We can work some toy examples and then trot out the abstruse pet-a-doggie or whatever.
Resist the urge to avoid practicality.
Little need for monads to do this:
main = readFile "haiku.txt" >>= putStrLn . number where number = lines . zipWith addNumber [0..] . unlines addNumber n l = show n ++ " " ++ l
What do you think >>= is? It is the piece unique to Monads.
So your “little need for monads” example shows the opposite.
main = interact number where number = lines . zipWith addNumber [0..] . unlines addNumber n l = show n ++ " " ++ l
But proven correct?
https://www-cs-faculty.stanford.edu/~knuth/faq.html
Just seeing the mechanics is the point.
We can work some toy examples and then trot out the abstruse pet-a-doggie or whatever.
Resist the urge to avoid practicality.