It so happens that Haskell currently insists on main :: IO ().  That's simple to fix, however, and with great pay-off.  Suppose instead main :: TV a (where I'm omitting the other TV type args for simplicity.)  Then a program could not only be run, but also composed with other programs.  They could even be composed by the end-user *while running*, as in Eros.
<br><br>Similarly, ghci implicitly inserts &quot;print&quot; when given a non-IO type.&nbsp; We could make that mechanism a little more general, and allow implicit insertions of other kinds of renderers, for purely functional images, music, 2D &amp; 3D geometry &amp; animation, interactive GUIs, etc.
<br><br>&nbsp; - Conal<br><br><div class="gmail_quote">On Dec 9, 2007 4:38 PM, Lennart Augustsson &lt;<a href="mailto:lennart@augustsson.net">lennart@augustsson.net</a>&gt; wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
I doubt all imperative programming will be banished from Haskell anytime soon.&nbsp; I really, really wish we had all the nice abstractions in place already, but we just don&#39;t.<br><br>You can&#39;t write any program in Haskell without using IO, because the type of main involves IO.
<br>And currently I believe that almost any real program will have to involve IO.<br>(BTW, the only H98 IO avoiding wrapper, interact, was included in Haskell because I insisted on it.)<br>It&#39;s just from my experience.&nbsp; No matter how pure your program is, here and there it will be interacting with the rest of the world.
<br><font color="#888888"><br>&nbsp; -- Lennart</font><div><div></div><div class="Wj3C7c"><br><br><div class="gmail_quote">On Dec 9, 2007 10:16 PM, Conal Elliott &lt;<a href="mailto:conal@conal.net" target="_blank">conal@conal.net
</a>&gt; wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

Thanks.&nbsp; If I&#39;m tracking, your real point is that imperative programming in Haskell is still useful enough to keep around.&nbsp; I agree.<br><br>I&#39;m still puzzled.&nbsp; Did you understand something I said, or maybe someone else said, as suggesting that imperative programming be removed from Haskell any time soon?
<div><br><br>&gt; It&#39;s also important to teach people to stay away from IO whenever possible, but it&#39;s simply not always possible. <br><br></div>How can we possibly teach them to stay away from IO where possible if we&#39;re also telling them that they can&#39;t write *any* real program without using IO?
<br><br>Cheers, - Conal<div><div></div><div><br><br><div class="gmail_quote">On Dec 9, 2007 12:02 PM, Lennart Augustsson &lt;<a href="mailto:lennart@augustsson.net" target="_blank">lennart@augustsson.net</a>
&gt; wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Conal,<br><br>It&#39;s true that you can avoid using IO (except for a wrapper) for certain kinds of programs.<br>For instance, if all you want is a String-&gt;String function, or some GUI program (you forgot to mention fudgets, which was the first wrapper of this kind) then you can ignore IO and just use a nice wrapper.
<br><br>But if someone asks me how to traverse a directory tree, invoking the &#39;file&#39; program for each &#39;,o&#39; file and then renaming it if it&#39;s a text file, then what should I answer?&nbsp; &quot;Sorry, you can&#39;t do that in Haskell.&quot;&nbsp; or &quot;You need to use the IO monad.&quot;?
<br>I prefer the latter answer, and I think people who learn Haskell need to learn something about how you do some of the things that are easy in other languages.<br><br>It&#39;s also important to teach people to stay away from IO whenever possible, but it&#39;s simply not always possible.
<br><font color="#888888"><br>&nbsp; -- Lennart</font><div><div></div><div><br><br><div class="gmail_quote">On Dec 9, 2007 5:31 PM, Conal Elliott &lt;<a href="mailto:conal@conal.net" target="_blank">conal@conal.net
</a>&gt; wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div>&gt; IO is important because you can&#39;t write any real program without using it.<br><br></div>Ouch!&nbsp; I get awfully discouraged when I read statements like this one.&nbsp; The more people who believe it, the more true it becomes.&nbsp; If you want to do functional programming, instead of imperative programming in a functional language, you can.&nbsp; For instance, write real, interactive programs in FRP, phooey, or TV.&nbsp; And if you do, you&#39;ll get semantic simplicity, powerful &amp; simpler reasoning, safety and composability.
<br><font color="#888888"><br>&nbsp; - Conal<br><br></font><div class="gmail_quote"><div>On Dec 8, 2007 1:26 AM, Lennart Augustsson &lt;<a href="mailto:lennart@augustsson.net" target="_blank">lennart@augustsson.net
</a>&gt; wrote:<br></div><div><div></div><div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
I agree with Dan here.<br><br>IO is important because you can&#39;t write any real program without using it.<br>So why not teach enough of it to get people off the ground straight away?<br><br>People who hang around long enough to do some more Haskell programming
<br>will run into the other monads sooner or later.&nbsp; But IO is an unavoidable step to<br>writing Haskell programs.<div><div></div><div><br><font color="#888888"><br><br></font><br><div class="gmail_quote">
On Dec 4, 2007 5:11 AM, Dan Piponi &lt;
<a href="mailto:dpiponi@gmail.com" target="_blank">dpiponi@gmail.com</a>&gt; wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div>





On Dec 3, 2007 6:36 PM, Ben Franksen &lt;
<a href="mailto:ben.franksen@online.de" target="_blank">ben.franksen@online.de</a>&gt; wrote:<br>&gt; then the special features of IO<br>&gt; will remain associated with monads in general, leading to a whole jumble of<br>





&gt; completely wrong ideas about them.
<br><br></div>As I only learnt about monads a couple of years ago, the process is<br>still fresh in my mind. I wasted quite a bit of time labouring under<br>the impression that monads were primarily about sequencing. But that
<br>wasn&#39;t because I incorrectly generalised from IO. It was because<br>countless people out there explicitly said they were about sequencing.<br>I suspect that if courses started with the List monad there&#39;d be<br>






countless blogs telling people that monads are a way to eliminate<br>loops from your code like the way list comprehensions are used in<br>Python.<br><div><br>&gt; This is yet another problem with IO as the standard example for monads: its
<br>&gt; effect base is huge and poorly structured.<br><br></div>You don&#39;t teach *all* of IO to students in one go!<br><div><br>&gt; This again makes it difficult to<br>&gt; see exactly which intuitions about IO can be generalized to arbitrary
<br>&gt; monads and which not.<br><br></div>That&#39;s true of any monad. IO is unique. [] is unique. Cont is unique.<br>All of them can lead you down the garden path. You need to see<br>multiple monads, and it helps if you can sneak an example under a
<br>student&#39;s nose so they can already reason about monads before they<br>even know what a monad is.<br><div><br>&gt; What is pointless about failure and how to handle it?<br><br></div>It&#39;s pointless when you&#39;re still trying to make your first tweaks to
<br>&quot;Hello, World!&quot; work.<br>--<br><font color="#888888">Dan<br></font><div><div></div><div>_______________________________________________<br>Haskell-Cafe mailing list<br><a href="mailto:Haskell-Cafe@haskell.org" target="_blank">






Haskell-Cafe@haskell.org</a><br><a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br></div></div></blockquote></div><br>
</div></div><br>_______________________________________________<br>Haskell-Cafe mailing list<br><a href="mailto:Haskell-Cafe@haskell.org" target="_blank">Haskell-Cafe@haskell.org</a><br><a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">





http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br><br></blockquote></div></div></div><br>
</blockquote></div><br>
</div></div></blockquote></div><br>
</div></div></blockquote></div><br>
</div></div></blockquote></div><br>