On 20031004T181216+0100, Alastair Reid wrote: > be careful to distinguish 'a value of type t' from 'a computation > which returns a value of type t'i
I always found the idea of a "computation" as a value a little hard to grasp. Therefore, when I introduced monadic transput in my functional programming course [1], I took the following approach: IO a is the type of a program with an exit value of type a; return, fail, putChar and getChar are primitive programs, and monadic transput is about combining programs using (>>=). The idea of denoting programs without executing them seems natural (in contrast to denoting computations without executing them). Likewise, it seems natural that there is a special mechanism for actually executing a program: either you give it to GHCi, or you bind it to Main.main and compile the module (thus, the program becomes synonymous with the expression that you bind to Main.main). Up until now, nobody in my class seems to have had problems with this mental model of monadic transput (of course, in grand tradition of Finnish universities, a large subset of my students are not actually attending sessions, so I wouldn't know about them until exam time). [1] Advanced-level introduction to FP; students are advanced undergrads or pre-master graduates. They have a strong background in imperattive programming, with the usual load of data structures and algorithms, operating systems, automata and formal languages theory (and other stuff depending on their tastes). (Note that printing a program is also a natural idea, and likewise natural is the idea that the output is unintelligible.) -- Antti-Juhani Kaijanaho, FM (MSc), http://www.mit.jyu.fi/antkaij/ ohjelmistotekniikan assistentti * assistant in software engineering Jyväskylän yliopisto * University of Jyväskylä Tietotekniikan laitos * Dept. of Mathematical Inf. Tech.
signature.asc
Description: Digital signature
_______________________________________________ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell