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> -- Lennart<br><br><div class="gmail_quote">On Dec 9, 2007 7:26 PM, Conal Elliott <<a href="mailto:email@example.com">firstname.lastname@example.org</a>> 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 <<a href="mailto:email@example.com" target="_blank">firstname.lastname@example.org</a>> wrote:<br><br>> Interactive programmes without using IO? Cool :)<br><br>And how!<br>
<br>> I think you misunderstood Lennart.
<br><br>Thanks for checking. In this case, I think I understood Lennart fine and that he was saying what you're saying.<br><br>> Would you deny that any useful programme has to do at least some of the following:<br>
> -accept programme arguments at invocation<br>> -get input, be it from a keyboard, mouse, reading files, pipes...<br>> -output a result or state info, to the monitor, a file, a pipe...<br> === <br><br>If by "programme", you mean the code I write, then I'm happy to deny that my programme has to do these things. Examples below. If you include a stateful RTS, then no I don't deny it.
<br><br>> I think Lennart was referring to that, you HAVE to know a little IO to write<br>> programmes, at least getArgs, getLine, putStr(Ln), readFile, writeFile,<br>> appendFile. And therefore some use of the IO monad has to be taught
<br>> relatively early.<br><br>Explicit imperative programming is just one way to deal with input & output, not the only way. As proof, see FRP, Pan, or TV programs, which contain uses of none of these functions. (Nor could they, as these libraries are functional, having IO-free types and semantics.) Moreover, use of imperative programming sacrifices some of the semantic simplicity & composability that makes FP so appealing. That's why I'd like to see this belief in its necessity dispelled.
<br><br>That said, I don't think the existing functional (non-IO) approaches to interaction are quite there yet with the flexibility of imperative programming. 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 "real programs". In that sense, Lennart's and your statements are self-fulfilling prophechies, as are mine.
<br><br>BTW, if you haven't seen it already, please check out <a href="http://haskell.org/haskellwiki/TV" target="_blank">http://haskell.org/haskellwiki/TV</a> . The TV (tangible values) approach includes a simple algebra of interfaces (input/output) and keeps separable from the core computation. The separability allows the interface parts to be composed in parallel with the core part. For instance, when two function-valued TVs are composed, the interfaces are peeled off, so that the core functions can be composed directly. The output half of one interface and the matching input half of the other are discarded. The remaining input and output halves are recombined into a new interface, which is used as the interface of the composed TV. 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's an example of combining the purity & composability I love about FP with the usability a "real" app. For more about this combination, please see my Google tech talk "Tangible Functional Programming: a modern marriage of usability and composability" (
<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>). That talk focus on end-user composability, but the essential points apply as well to explicit programming. 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, - 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>> > IO is important because you can't write any real program without using<br>> > it.<br>><br>> Ouch! I get awfully discouraged when I read statements like this one. The<br>
> more people who believe it, the more true it becomes. If you want to do<br>> functional programming, instead of imperative programming in a functional<br>> language, you can. For instance, write real, interactive programs in FRP,
<br>> phooey, or TV. And if you do, you'll get semantic simplicity, powerful &<br>> simpler reasoning, safety and composability.<br>><br>> - Conal</div></blockquote> <div>> > On Dec 8, 2007 1:26 AM, Lennart Augustsson <
<a href="mailto:email@example.com" target="_blank">firstname.lastname@example.org</a>> wrote:<br><br>> > [...]<br><br>> > IO is important because you can'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. But IO is an unavoidable step to<br>> > writing Haskell programs.
<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">