[Haskell-cafe] Re: Where do I put the seq?

Peter Verswyvelen bugfact at gmail.com
Fri Aug 21 15:29:46 EDT 2009

On Fri, Aug 21, 2009 at 6:53 PM, David Menendez <dave at zednenem.com> wrote:

> You would still need to determine whether you've reached EOF or not,
> which forces the input to be determined up to the first line-break or
> EOF.

Good point!  I actually had it on my TODO list, but that settles it then :)

 run :: MyIO () -> Behavior
> run m = runCont m (\_ _ -> [])
> > foo = do
> >    putLine "Enter name: "
> >    name <- getLine
> >    putLine ("Welcome " ++ name ++ "\n")
> > main = interact (run foo . lines)
> > You get the "Welcome" before the name again.
> > To be honest I don't fully understand why this is a horrible hack.
> It isn't. Some people dislike seq because it lets you force strictness
> in cases where pattern matching cannot (like function arguments), but
> hardly anyone objects to pattern matching.

Ah so it's subjective. Okay, it's sometimes hard for a newbie to find the
"truth" when several experts contradict eachother. Because often when people
claim something here, they have very good reasons for it, reasons that are
not obvious at all to your average newbie!

> > Too bad that something extremely simple like console text IO doesn't seem
> to
> > be a good start for introducing FRP, or maybe seen from another angle
> (using
> > Reactive) it might still be, dono
> Are you writing an introduction to using FRP, or an introduction to
> implementing FRP? Every Haskell FRP implementation I'm aware of uses
> the IO monad internally.

Both really. I think to start with I just want to start a blog to write down
random pieces (like this interesting conversation), and then see where this
will lead me. I'm mainly interested in doing a survey of existing systems,
comparing pros/cons with clear examples (at least for myself ;), and also
making minimal implementations so I understand the essence of the various

If you want to be able to run in an entirely pure manner, you might
> investigate IOSpec.
> <http://hackage.haskell.org/package/IOSpec>

Ah I didn't know that one yet, thanks

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20090821/c113b2ab/attachment.html

More information about the Haskell-Cafe mailing list