Problem 1: The source of exceptions is obscured
main = getArgs >>= readFile . head >>= print . length
Even though length
is a pure function, this is where the I/O will happen (lazily), which means that is where any exceptions relating to I/O will [...]
I have found that arrows in Haskell are far simpler than they might appear based on the literature. They are simply abstractions of functions. To see how this is practically useful, consider that you have a bunch of functions you want to compose, where some of them are pure and some are monadic. For example, f :: a -> [...]