| A Gordon [Feb 1989], "PFL+: a kernel scheme for functional I/O," TR 160, Computer Lab, University of Cambridge. |
....purely functional emulation is known. The reverse function, ioToD does not suffer from these problems, and this asymmetry is the main reason that Dialogues are specified as primitive in Haskell. We return to this this matter in Section 5.3. 3. 2 Continuations The continuation style I O model (Gordon [1989]; Hudak Sundaresh [1989] Karlsson [1982] Perry [1991] provides primitive I O operations which take as one of their arguments a continuation which says what to do after the I O operation is performed: main : Result putcC : Char Result Result getcC : Char Result) Result doneC ....
.... s = fOpenIO s bindIO f delayIO (lazyRd f) lazyRd : File IO [Char] lazyRd f = readChar f bindIO a if (a = eof) then fCloseIO f seqIO unitIO [ else delayIO (lazyRd f) bindIO as unitIO (a:as) The delayIO combinator provides essentially the power of Gordon s suspend operator (Gordon [1989]) Implementation. A nice feature of the implementation technique outlined in Section 4 is that delayIO is very easy to define: delayIO m = w let res = case (m w) of MkIORes r w r in MkIORes res w In contrast to bindIO, notice how delayIO duplicates the world w, and then discards the ....
A Gordon [Feb 1989], "PFL+: a kernel scheme for functional I/O," TR 160, Computer Lab, University of Cambridge.
Online articles have much greater impact More about CiteSeer.IST Add search form to your site Submit documents Feedback
CiteSeer.IST - Copyright Penn State and NEC