Quantcast
Channel: Should do-notation be avoided in Haskell? - Stack Overflow
Browsing all 8 articles
Browse latest View live

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 Article



Answer 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 Article

Answer 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 Article

Answer 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 Article

Answer 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 Article


Answer 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 Article

Answer 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 Article

Should 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

Browsing all 8 articles
Browse latest View live




Latest Images