[Haskell] Space behaviour & hyperseq

Colin Runciman colin at cs.york.ac.uk
Fri Jun 18 09:34:00 EDT 2004


>> the result of an application 'normal x' is always true ...
> I understand how this works,
> but do we agree that it looks outright ugly?

I don't see why

f x | normal x = ... x ...

is any more ugly than

f x@(x : xs) = ... x ...

or (far worse)

f ~(x : xs) = ... x ...

or strictness annotations, or uses of `seq`, all of which I try to avoid.

I prefer to use the ordinary stuff of a programming language to achieve 
pragmatic ends, so far as possible, rather than adding "magical" 

> We mean one thing (strictness) but we write something quite different
> (an "obviously useless" computation of the constant True).

A 'normal' application doesn't have to mean one thing only: it is 
polymorphic, allowing distinct degrees of evaluation to be defined for 
distinct types.  The result of a normal application may be "useless" but 
the effect of computing it can be extremely useful for pragmatic reasons.

> Can you explain this to students? Would you be proud of it?

I can and have explained it to students.  It is nothing wonderful, but 
it is nothing to be ashamed of.  It can even be rather elegant if used 
with care.

Well ... that's my opinion anyway!

Colin R

More information about the Haskell mailing list