<div dir="auto">Thank you David and PY, that is exactly what I meant. And of course, Gabriel's blog knocks it out of the park as usual!</div><br><div class="gmail_quote"><div dir="ltr">On Tue, Jul 10, 2018, 6:06 AM PY <<a href="mailto:aquagnu@gmail.com">aquagnu@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div text="#000000" bgcolor="#FFFFFF">
    <p>More interesting example from Gabriel Gonzalez:
      <a class="m_6839042600589116634moz-txt-link-freetext" href="http://www.haskellforall.com/2018/02/the-wizard-monoid.html" target="_blank" rel="noreferrer">http://www.haskellforall.com/2018/02/the-wizard-monoid.html</a>  :)<br>
    </p>
    <br>
    <div class="m_6839042600589116634moz-cite-prefix">10.07.2018 15:50, David McBride wrote:<br>
    </div>
    <blockquote type="cite">
      
      <div dir="ltr">
        <div>No, he means that an IO action is just another type.  For
          example you can have a list of IO actions, Then you can take
          one of them and execute them.  Then you can execute that one
          action again as many times as you want, because an IO action
          is just a type like any other type until it is executed. 
          These examples are utterly contrived.<br>
        </div>
        <div><br>
        </div>
        foo :: [IO String]<br>
        foo = [return "25", print "hello" >> return "qwerty",
        getLine]<br>
        <br>
        foo !! 3 :: IO String<br>
        <br>
        bar :: [IO Int]<br>
        bar = map (fmap read) foo<br>
        <div><br>
        </div>
        <div>main :: IO ()<br>
        </div>
        main = do<br>
          str <- foo !! 2  <br>
          print str<br>
          str2 <- foo !! 2<br>
          print str2<br>
          i <- head bar<br>
          print (i + 1)<br>
        <br>
        <div>Even main is just a data structure until the compiler
          decides to execute it.  It could have been written as an
          expression.</div>
        <div><br>
        </div>
        <div>main = foo !! 2 >>= \str -> print str >> foo
          !! 2 >>= \str2 -> print str2 >> head bar
          >>= \i -> print (i + 1)<br>
          <br>
        </div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div><br>
        </div>
      </div>
      <div class="gmail_extra"><br>
        <div class="gmail_quote">On Tue, Jul 10, 2018 at 8:29 AM,
          Olivier Revollat <span dir="ltr"><<a href="mailto:revollat@gmail.com" target="_blank" rel="noreferrer">revollat@gmail.com</a>></span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div dir="ltr">
              <div>Yes absolutely ! you're referring to laziness right ?</div>
              <div><br>
              </div>
            </div>
            <div class="m_6839042600589116634HOEnZb">
              <div class="m_6839042600589116634h5"><br>
                <div class="gmail_quote">
                  <div dir="ltr">Le mar. 10 juil. 2018 à 14:20, Theodore
                    Lief Gannon <<a href="mailto:tanuki@gmail.com" target="_blank" rel="noreferrer">tanuki@gmail.com</a>>
                    a écrit :<br>
                  </div>
                  <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
                    <div dir="auto">An intuition that really clicked for
                      me is that in Haskell IO code, as in all Haskell
                      code, you are describing a pristine and perfectly
                      inert data structure. It happens to *represent* a
                      set of imperative instructions that the totally
                      impure runtime environment can execute, but that's
                      not your problem!</div>
                    <br>
                    <div class="gmail_quote">
                      <div dir="ltr">On Tue, Jul 10, 2018, 4:55 AM
                        Olivier Revollat <<a href="mailto:revollat@gmail.com" target="_blank" rel="noreferrer">revollat@gmail.com</a>>
                        wrote:<br>
                      </div>
                      <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
                        <div dir="ltr">Thanks ! <br>
                        </div>
                        <br>
                        <div class="gmail_quote">
                          <div dir="ltr">Le mar. 10 juil. 2018 à 13:14,
                            PY <<a href="mailto:aquagnu@gmail.com" rel="noreferrer noreferrer" target="_blank">aquagnu@gmail.com</a>>
                            a écrit :<br>
                          </div>
                          <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
                            <div text="#000000" bgcolor="#FFFFFF">
                              <p>May be something like this?</p>
                              <p><b>Free monads</b> ("applicative"
                                style/interpreting trees) and Effects:</p>
                              <a class="m_6839042600589116634m_-2448708698946355522m_-7758219068530445940m_699401305901810554m_1124748471038346571moz-txt-link-freetext" href="https://markkarpov.com/post/free-monad-considered-harmful.html" rel="noreferrer noreferrer" target="_blank">https://markkarpov.com/post/free-monad-considered-harmful.html</a><br>
                              <a class="m_6839042600589116634m_-2448708698946355522m_-7758219068530445940m_699401305901810554m_1124748471038346571moz-txt-link-freetext" href="https://mmhaskell.com/blog/2017/11/20/eff-to-the-rescue" rel="noreferrer noreferrer" target="_blank">https://mmhaskell.com/blog/2017/11/20/eff-to-the-rescue</a><br>
                              <br>
                              <b>Arrows</b> (something like
                              "flow"-style):<br>
                              <a class="m_6839042600589116634m_-2448708698946355522m_-7758219068530445940m_699401305901810554m_1124748471038346571moz-txt-link-freetext" href="https://www.haskell.org/arrows/" rel="noreferrer noreferrer" target="_blank">https://www.haskell.org/arrows/</a><br>
                              <a class="m_6839042600589116634m_-2448708698946355522m_-7758219068530445940m_699401305901810554m_1124748471038346571moz-txt-link-freetext" href="http://tuttlem.github.io/2014/07/26/practical-arrow-usage.html" rel="noreferrer noreferrer" target="_blank">http://tuttlem.github.io/2014/07/26/practical-arrow-usage.html</a><br>
                              <br>
                              <br>
                              <div class="m_6839042600589116634m_-2448708698946355522m_-7758219068530445940m_699401305901810554m_1124748471038346571moz-cite-prefix">10.07.2018
                                12:22, Olivier Revollat wrote:<br>
                              </div>
                              <blockquote type="cite">
                                <div dir="ltr">Hi, <br>
                                  I've been using imperative languages
                                  for 20 years now :)<br>
                                  <br>
                                  I'm a beginner in haskell and I love
                                  the paradigm shift you feel when you
                                  come from imperative programming. I
                                  found interesting articles like :<br>
                                  <a href="https://wiki.haskell.org/Haskell_IO_for_Imperative_Programmers" rel="noreferrer noreferrer" target="_blank">https://wiki.haskell.org/Haskell_IO_for_Imperative_Programmers</a><br>
                                  <br>
                                  Do you have any other ressources like
                                  that ?<br>
                                  I'm not looking for how to use haskell
                                  in imperative style (e.g. with "do"
                                  notation, ...) no no ! I'm looking
                                  articles who explain how NOT TO USE
                                  imperative style with haskell, and
                                  help thinking the paradigm shift ...<br>
                                  <br>
                                  Thanks :)<br>
                                  <div><br>
                                  </div>
                                </div>
                                <br>
                                <fieldset class="m_6839042600589116634m_-2448708698946355522m_-7758219068530445940m_699401305901810554m_1124748471038346571mimeAttachmentHeader"></fieldset>
                                <br>
                                <pre>_______________________________________________
Beginners mailing list
<a class="m_6839042600589116634m_-2448708698946355522m_-7758219068530445940m_699401305901810554m_1124748471038346571moz-txt-link-abbreviated" href="mailto:Beginners@haskell.org" rel="noreferrer noreferrer" target="_blank">Beginners@haskell.org</a>
<a class="m_6839042600589116634m_-2448708698946355522m_-7758219068530445940m_699401305901810554m_1124748471038346571moz-txt-link-freetext" href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners" rel="noreferrer noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners</a>
</pre>
                              </blockquote>
                              <br>
                            </div>
                            _______________________________________________<br>
                            Beginners mailing list<br>
                            <a href="mailto:Beginners@haskell.org" rel="noreferrer noreferrer" target="_blank">Beginners@haskell.org</a><br>
                            <a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners" rel="noreferrer noreferrer noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners</a><br>
                          </blockquote>
                        </div>
                        _______________________________________________<br>
                        Beginners mailing list<br>
                        <a href="mailto:Beginners@haskell.org" rel="noreferrer noreferrer" target="_blank">Beginners@haskell.org</a><br>
                        <a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners" rel="noreferrer noreferrer noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners</a><br>
                      </blockquote>
                    </div>
                    _______________________________________________<br>
                    Beginners mailing list<br>
                    <a href="mailto:Beginners@haskell.org" target="_blank" rel="noreferrer">Beginners@haskell.org</a><br>
                    <a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners" rel="noreferrer noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners</a><br>
                  </blockquote>
                </div>
              </div>
            </div>
            <br>
            _______________________________________________<br>
            Beginners mailing list<br>
            <a href="mailto:Beginners@haskell.org" target="_blank" rel="noreferrer">Beginners@haskell.org</a><br>
            <a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners" rel="noreferrer noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners</a><br>
            <br>
          </blockquote>
        </div>
        <br>
      </div>
      <br>
      <fieldset class="m_6839042600589116634mimeAttachmentHeader"></fieldset>
      <br>
      <pre>_______________________________________________
Beginners mailing list
<a class="m_6839042600589116634moz-txt-link-abbreviated" href="mailto:Beginners@haskell.org" target="_blank" rel="noreferrer">Beginners@haskell.org</a>
<a class="m_6839042600589116634moz-txt-link-freetext" href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners" target="_blank" rel="noreferrer">http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners</a>
</pre>
    </blockquote>
    <br>
  </div>

_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org" target="_blank" rel="noreferrer">Beginners@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners" rel="noreferrer noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners</a><br>
</blockquote></div>