Most Haskell tutorials teach the use of do-notation for IO.
I also started with the do-notation, but that makes my code look more like an imperative language more than a FP language.
This week I saw a tutorial use IO with
stringAnalyzer <$> readFile "testfile.txt"
instead of using
main = do strFile <- readFile "testfile.txt" let analysisResult = stringAnalyzer strFile return analysisResult
And the log analysis tool is finished without the
So my question is "Should we avoid do-notation in any case?".
I know maybe
do will make the code better in some cases.
Also, why do most tutorials teach IO with
In my opinion
<*> makes the code more FP than IO.