I'm new to haskell and functional programming in general and I have a problem with monads. Let's say I have got a list of filenames:
-- do block --
let filenames = ["file1","file2"]
and I want to generate a list of those files' content, using list comprehensions:
let content = [str <- readFile f | f <- filenames]
Ofc, this kind of usage is not valid. As I understand this kind of "assignment" can be used in do block, when "chaining" the result with the next instruction.
Is there maybe an alternative way to use the left arrow (or >>=) operator. I imagine sth like this:
let content = [leftArrAlter $ readFile f | f <- filenames]