On Thu, Aug 20, 2009 at 11:23 PM, David Menendez <d...@zednenem.com> wrote:
> The important things to note are (1) getChar# depends on the token > returned by putChar#, thus guaranteeing that putChar# gets executed > first, and (2) putChar# and getChar# are impure and cannot normally be > defined in Haskell. > Ok, that I understand. But if getChar# and putChar# would be pure functions that just generate some output string / consume some input string, then this realworld token passing would not work when used with interact, since neither the output or input string really depends on the dummy token, unless using a seq again (or strictness annotation, which was explained to be just syntactic sugar for seq)? But how would we then make a pure monad that can be used as in my example together with interact? I see no reason why to put everything in IO when it just comes to converting a stream of inputs to a stream of outputs? So interact really is useless, unless you just fmap something over the input or when the output is independent from the input? As Ryan said, I could use his MonadPrompt for this, but that's a different approach (and maybe the only correct one) I'm still curious to see how an FRP solution would look for simple console based IO though :-) Probably a good exercise to do. > > -- > Dave Menendez <d...@zednenem.com> > <http://www.eyrie.org/~zednenem/> >
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe