Conal,<br><br>I think TV etc. is fantastic stuff, but that mean that we cannot, say, invoke an external program in Haskell until someone has figured out a composable library for this?<br>I sincerely hope someone will, but the only way we have right now is the ugly IO monad.
<br><br>&nbsp; -- Lennart<br><br><div class="gmail_quote">On Dec 9, 2007 7:26 PM, Conal Elliott &lt;<a href="mailto:conal@conal.net">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;">
On Dec 9, 2007 10:07 AM, Daniel Fischer &lt;<a href="mailto:daniel.is.fischer@web.de" target="_blank">daniel.is.fischer@web.de</a>&gt; wrote:<br><br>&gt; Interactive programmes without using IO? Cool :)<br><br>And how!<br>
<br>&gt; I think you misunderstood Lennart.
<br><br>Thanks for checking.&nbsp; In this case, I think I understood Lennart fine and that he was saying what you&#39;re saying.<br><br>&gt; Would you deny that any useful programme has to do at least some of the following:<br>

&gt; -accept programme arguments at invocation<br>&gt; -get input, be it from a keyboard, mouse, reading files, pipes...<br>&gt; -output a result or state info, to the monitor, a file, a pipe...<br>&nbsp;&nbsp; === <br><br>If by &quot;programme&quot;, you mean the code I write, then I&#39;m happy to deny that my programme has to do these things.&nbsp; Examples below.&nbsp; If you include a stateful RTS, then no I don&#39;t deny it.
<br><br>&gt; I think Lennart was referring to that, you HAVE to know a little IO to write<br>&gt; programmes, at least getArgs, getLine, putStr(Ln), readFile, writeFile,<br>&gt; appendFile. And therefore some use of the IO monad has to be taught
<br>&gt; relatively early.<br><br>Explicit imperative programming is just one way to deal with input &amp; output, not the only way.&nbsp; As proof, see FRP, Pan, or TV programs, which contain uses of none of these functions.&nbsp; (Nor could they, as these libraries are functional, having IO-free types and semantics.)&nbsp; Moreover, use of imperative programming sacrifices some of the semantic simplicity &amp; composability that makes FP so appealing.&nbsp; That&#39;s why I&#39;d like to see this belief in its necessity dispelled.
<br><br>That said, I don&#39;t think the existing functional (non-IO) approaches to interaction are quite there yet with the flexibility of imperative programming.&nbsp; It will take more work to get them there, and that work is mostly likely to be pursued by people who doubt the necessity of IO for writing &quot;real programs&quot;.&nbsp; In that sense, Lennart&#39;s and your statements are self-fulfilling prophechies, as are mine.
<br><br>BTW, if you haven&#39;t seen it already, please check out <a href="http://haskell.org/haskellwiki/TV" target="_blank">http://haskell.org/haskellwiki/TV</a> .&nbsp; The TV (tangible values) approach includes a simple algebra of interfaces (input/output) and keeps separable from the core computation.&nbsp; The separability allows the interface parts to be composed in parallel with the core part.&nbsp; For instance, when two function-valued TVs are composed, the interfaces are peeled off, so that the core functions can be composed directly.&nbsp; The output half of one interface and the matching input half of the other are discarded.&nbsp; The remaining input and output halves are recombined into a new interface, which is used as the interface of the composed TV.&nbsp; The core interface algebra can be used for text stream i/o, GUIs, and many other possible styles of information passing.
<br><br>I mention TV, because it&#39;s an example of combining the purity &amp; composability I love about FP with the usability a &quot;real&quot; app.&nbsp; For more about this combination, please see my Google tech talk &quot;Tangible Functional Programming: a modern marriage of usability and composability&quot; (
<a href="http://conal-elliott.blogspot.com/2007/11/tangible-functional-programming-modern.html" target="_blank">http://conal-elliott.blogspot.com/2007/11/tangible-functional-programming-modern.html</a>).&nbsp; That talk focus on end-user composability, but the essential points apply as well to explicit programming.&nbsp; As I mentioned before, TV (a) is currently less flexible than imperative/IO programming, and (b) has the composability, guaranteed safety, and amenability to reasoning of pure functional programming.
<br><br><br>Cheers,&nbsp; - Conal<br><br><br><div class="gmail_quote"><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Am Sonntag, 9. Dezember 2007 18:31 schrieb Conal Elliott:
<br><div>&gt; &gt; IO is important because you can&#39;t write any real program without using<br>&gt; &gt; it.<br>&gt;<br>&gt; Ouch! &nbsp;I get awfully discouraged when I read statements like this one. &nbsp;The<br>
&gt; more people who believe it, the more true it becomes. &nbsp;If you want to do<br>&gt; functional programming, instead of imperative programming in a functional<br>&gt; language, you can. &nbsp;For instance, write real, interactive programs in FRP,
<br>&gt; phooey, or TV. &nbsp;And if you do, you&#39;ll get semantic simplicity, powerful &amp;<br>&gt; simpler reasoning, safety and composability.<br>&gt;<br>&gt; &nbsp; - Conal</div></blockquote>&nbsp;<div>&gt; &gt; 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><br>&gt; &gt; [...]<br><br>&gt; &gt; IO is important because you can&#39;t write any real program without using it.<br>&gt; &gt; So why not teach enough of it to get people off the ground straight away?
<br><br>&gt; &gt; People who hang around long enough to do some more Haskell programming<br>&gt; &gt; will run into the other monads sooner or later.&nbsp; But IO is an unavoidable step to<br>&gt; &gt; writing Haskell programs.
<br><br>&nbsp;</div></div><br>
<br>_______________________________________________<br>Haskell-Cafe mailing list<br><a href="mailto:Haskell-Cafe@haskell.org">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><br>