<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p>More interesting example from Gabriel Gonzalez:
<a class="moz-txt-link-freetext" href="http://www.haskellforall.com/2018/02/the-wizard-monoid.html">http://www.haskellforall.com/2018/02/the-wizard-monoid.html</a> :)<br>
</p>
<br>
<div class="moz-cite-prefix">10.07.2018 15:50, David McBride wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CAN+Tr41sAnFQTkuSYvR2m+XdkMQisvFhdfH3YdTj0R_uyW3rSw@mail.gmail.com">
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<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"
moz-do-not-send="true">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="HOEnZb">
<div class="h5"><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" moz-do-not-send="true">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" moz-do-not-send="true">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" target="_blank"
moz-do-not-send="true">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_-2448708698946355522m_-7758219068530445940m_699401305901810554m_1124748471038346571moz-txt-link-freetext"
href="https://markkarpov.com/post/free-monad-considered-harmful.html"
rel="noreferrer" target="_blank"
moz-do-not-send="true">https://markkarpov.com/post/<wbr>free-monad-considered-harmful.<wbr>html</a><br>
<a
class="m_-2448708698946355522m_-7758219068530445940m_699401305901810554m_1124748471038346571moz-txt-link-freetext"
href="https://mmhaskell.com/blog/2017/11/20/eff-to-the-rescue"
rel="noreferrer" target="_blank"
moz-do-not-send="true">https://mmhaskell.com/blog/<wbr>2017/11/20/eff-to-the-rescue</a><br>
<br>
<b>Arrows</b> (something like
"flow"-style):<br>
<a
class="m_-2448708698946355522m_-7758219068530445940m_699401305901810554m_1124748471038346571moz-txt-link-freetext"
href="https://www.haskell.org/arrows/"
rel="noreferrer" target="_blank"
moz-do-not-send="true">https://www.haskell.org/<wbr>arrows/</a><br>
<a
class="m_-2448708698946355522m_-7758219068530445940m_699401305901810554m_1124748471038346571moz-txt-link-freetext"
href="http://tuttlem.github.io/2014/07/26/practical-arrow-usage.html"
rel="noreferrer" target="_blank"
moz-do-not-send="true">http://tuttlem.github.io/2014/<wbr>07/26/practical-arrow-usage.<wbr>html</a><br>
<br>
<br>
<div
class="m_-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" target="_blank"
moz-do-not-send="true">https://wiki.haskell.org/<wbr>Haskell_IO_for_Imperative_<wbr>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_-2448708698946355522m_-7758219068530445940m_699401305901810554m_1124748471038346571mimeAttachmentHeader"></fieldset>
<br>
<pre>______________________________<wbr>_________________
Beginners mailing list
<a class="m_-2448708698946355522m_-7758219068530445940m_699401305901810554m_1124748471038346571moz-txt-link-abbreviated" href="mailto:Beginners@haskell.org" rel="noreferrer" target="_blank" moz-do-not-send="true">Beginners@haskell.org</a>
<a class="m_-2448708698946355522m_-7758219068530445940m_699401305901810554m_1124748471038346571moz-txt-link-freetext" href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners" rel="noreferrer" target="_blank" moz-do-not-send="true">http://mail.haskell.org/cgi-<wbr>bin/mailman/listinfo/beginners</a>
</pre>
</blockquote>
<br>
</div>
______________________________<wbr>_________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org"
rel="noreferrer" target="_blank"
moz-do-not-send="true">Beginners@haskell.org</a><br>
<a
href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners"
rel="noreferrer noreferrer"
target="_blank" moz-do-not-send="true">http://mail.haskell.org/cgi-<wbr>bin/mailman/listinfo/beginners</a><br>
</blockquote>
</div>
______________________________<wbr>_________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org"
rel="noreferrer" target="_blank"
moz-do-not-send="true">Beginners@haskell.org</a><br>
<a
href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners"
rel="noreferrer noreferrer" target="_blank"
moz-do-not-send="true">http://mail.haskell.org/cgi-<wbr>bin/mailman/listinfo/beginners</a><br>
</blockquote>
</div>
______________________________<wbr>_________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org"
target="_blank" moz-do-not-send="true">Beginners@haskell.org</a><br>
<a
href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners"
rel="noreferrer" target="_blank"
moz-do-not-send="true">http://mail.haskell.org/cgi-<wbr>bin/mailman/listinfo/beginners</a><br>
</blockquote>
</div>
</div>
</div>
<br>
______________________________<wbr>_________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org"
moz-do-not-send="true">Beginners@haskell.org</a><br>
<a
href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners"
rel="noreferrer" target="_blank" moz-do-not-send="true">http://mail.haskell.org/cgi-<wbr>bin/mailman/listinfo/beginners</a><br>
<br>
</blockquote>
</div>
<br>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Beginners mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Beginners@haskell.org">Beginners@haskell.org</a>
<a class="moz-txt-link-freetext" href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners">http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners</a>
</pre>
</blockquote>
<br>
</body>
</html>