Answer by Petr for Should do-notation be avoided in Haskell?
Should we avoid do-notation in any case?I'd say definitely no. For me, the most important criterion in such cases is to make the code as much readable and understandable as possible. The do-notation...
View ArticleAnswer by leftaroundabout for Should do-notation be avoided in Haskell?
In my opinion <$> and <*> makes the code more FP than IO.Haskell is not a purely functional language because that "looks better". Sometimes it does, often it doesn't. The reason for staying...
View ArticleAnswer by Benjamin Hodgson for Should do-notation be avoided in Haskell?
I often find myself first writing a monadic action in do notation, then refactoring it down to a simple monadic (or functorial) expression. This happens mostly when the do block turns out to be shorter...
View ArticleAnswer by Romildo for Should do-notation be avoided in Haskell?
The do notation is expanded to an expression using the functions (>>=) and (>>), and the let expression. So it is not part of the core of the language.(>>=) and (>>) are used to...
View ArticleAnswer by Sergey Bolgov for Should do-notation be avoided in Haskell?
do notation is just a syntactic sugar. It can be avoided in all cases. However, in some cases replacing do with >>= and return makes code less readable.So, for your questions:"Shall we avoid the...
View ArticleAnswer by cheecheeo for Should do-notation be avoided in Haskell?
Applicative style should be encouraged because it composes (and it is prettier). Monadic style is necessary in certain cases. See https://stackoverflow.com/a/7042674/1019205 for an in depth explanation.
View ArticleAnswer by daniel gratzer for Should do-notation be avoided in Haskell?
do notation in Haskell desugars in a pretty simple way.do x <- foo e1 e2 ...turns into foo >>= \x -> do e1 e2anddo x e1 e2 ...intox >>do e1 e2 ....This means you can really write any...
View ArticleShould do-notation be avoided in Haskell?
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...
View Article