Talk:Haskell/do Notation/Archive 1

Unclear passages
I'm not an expert in either monads or Haskell, but I am rather familiar with both. Yet I do not understand the following phrase in the beginning: "that monad does not allow to extract pure values from it by design; in contrast, you can extract pure values from Maybe or lists using pattern matching or appropriate functions". I expect this phrase --as it stands now, in particular the word "extract"-- is not helpful for beginners.

Related, the last sentence of section "Translating the bind operator" says: "Notice that the variables left of the <- in the do block have been extracted from the monad, so if action produces e.g. a IO String, the type of result will be String." Should I have been able to make this observation myself, or is it the author's task to explain the observation? I think the latter. This is the first point where I can make sense of the concept of "extracting a value out of a monad".

I think the example (in Translating the bind) can be made clearer. Now it reads: "do result <- action; another_result <- another_action; (action_based_on_previous_results result another_result)" and I would prefer "do x1 <- action1; x2 <- action2; (action3 x1 x2)". MMF (discuss • contribs) 08:50, 25 May 2011 (UTC)


 * This chapter is indeed a little problematic. The more I look at it, the less satisfactory it appears. Even removing it doesn't seem such a bad idea, except that it would force us to talk more about do notation in Understanding Monads, which would not be appropriate. Duplode (discuss • contribs) 08:32, 11 October 2013 (UTC)


 * I just changed the text rather extensively to address the concerns raised above and provide better advice. Duplode (discuss • contribs) 21:51, 13 October 2013 (UTC)