Re: Extending the do-notation
import Monad ... do y <- liftM unzip m1
Thanks. 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"). Is there a paper demonstrating the most common coding styles for do-notation ? Another question concerning the do-notation: I noticed that most parts of ghc do not use it. Is it because the code was written before the notation was available, because the do-notation is too weak to express these parts, or for another fundamental reason ?
Sebastien Carlier wrote:
I'm constantly amazed by the number of tricks one has to know before he can write concise code using the do-notation [...]
In my experience it is not the do-notation itself, but the mixture of monadic actions and higher-order functions. But after a while you´ll really like it. :-)
Another question concerning the do-notation: I noticed that most parts of ghc do not use it. Is it because the code was written before the notation was available, because the do-notation is too weak to express these parts, or for another fundamental reason ?
It's only because of historical reasons, nothing more. Cheers, Sven
Sebastien Carlier wrote:
import Monad ... do y <- liftM unzip m1
Thanks.
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").
[snip] 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?
participants (3)
-
George Russell -
Sebastien Carlier -
Sven Panne