newbie conceptual question [from haskell list]

D. Tweed
Thu, 26 Jul 2001 11:55:01 +0100 (BST)

On Thu, 26 Jul 2001, Frank Atanassow wrote:
> also safety, and "theorems for free". Then there are other properties
> are obvious (to a programmer) in a Haskell program which get buried in
> equivalent C(++) program, e.g., that every member of a data structure is
> traversed in a fold ("no early exits"). Many of these things hinge on
> typing of a program, which is inferred and checked for you, so there is
> of a burden on conscientious programmers.

I'm being terribly unfair here; this was probably just a simple slip when
writing a hurried e-mail but if you mean what I think you mean about the

undefd = undefd

f y x|y=='a' = "finished"
     |otherwise = y:x

g xs = foldr f "" xs

Main> g ('a':undefd)

shows that folds can exit early; if it didn't it'd black hole forever.

___cheers,_dave________________________________________________________ |tweed's law:  however many computers
email:      |   you have, half your time is spent
work tel: (0117) 954-5250       |   waiting for compilations to finish.