Extending the do-notation
Mon, 8 Jan 2001 12:07:17 +0100
> > I'm constantly amazed by the number of tricks one has
> > to know before he can write concise code using the
> > do-notation (among other things, I used to write
> > "x <- return $ m" instead of "let x = m").
> Why do you WANT to write concise code using the do-notation?
> Has someone revived the Obfuscated Haskell Contest, or
> do you find touch-typing difficult?
Which of the following is easier to read (and please forgive
the short variable names) ?
> x <- return $ m
> let x = m
> x <- m
> let (a, b) = unzip x
> ... -- (and this code uses an extra variable)
> (a, b) <- unzip `liftM` m
Concise does not mean obfuscated. Unnecessarily inflating your code
will not make it more readable. Or am I wrong ?