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

Lennart Augustsson lennart at augustsson.net
Thu Aug 20 13:12:44 EDT 2009


Using seq to control a program's semantics (as in, input-output
behaviour) is a horrible hack.
The seq operation there to control space and time aspects of your program.
(The specification of seq doesn't even say that the first argument is
evaluated before the second one.)
You should use data dependencies to control your program's semantics.

On Thu, Aug 20, 2009 at 4:34 PM, David Leimbach<leimy2k at gmail.com> wrote:
>
>
> On Thu, Aug 20, 2009 at 2:52 AM, Jules Bean <jules at jellybean.co.uk> wrote:
>>
>> Peter Verswyvelen wrote:
>>>
>>> Not at all, use it for whatever you want to :-)
>>>
>>> I'm writing this code because I'm preparing to write a bunch of tutorials
>>> on FRP, and I first wanted to start with simple console based FRP, e.g.
>>> making a little text adventure game, where the input/choices of the user
>>> might be parsed ala parsec, using monadic style, applicative style, and
>>> arrows, and then doing the same with FRP frameworks like
>>
>>
>> This is a really bad place to start a FRP tutorial IMO.
>>
>> The interface for 'interact' does not make any promises about the relative
>> evaluation order of the input list / production order of the output list.
>>
>> That's why you are having to play horrible tricks with seq to try to force
>> the order to be what you want.
>>
>> I don't think this is the basis of a robust system or a sensible tutorial.
>>
>> Just my 2c.
>
> Interesting feedback, but I don't get the reason really.  How is using seq a
> "horrible trick"?  It's there for strict evaluation when you need it, and in
> this case it was warranted.
> And as far as saying it's not a good basis for a robust system, I'm also not
> sure I agree, but a "sensible tutorial", that I could believe as I think
> it's actually quite difficult to explain these topics to people in a way
> they're going to understand right away.
> Could we perhaps bother you to suggest an alternative along with your
> criticism?  It would feel a little more constructive at least (not that I
> think you were being terribly harsh)
> Dave
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
>


More information about the Haskell-Cafe mailing list