[Haskell-cafe] Re: Functional programming for processing of largeraster images

Ralf Hinze ralf at informatik.uni-bonn.de
Wed Jun 21 16:02:43 EDT 2006


Am Mittwoch 21 Juni 2006 21:30 schrieb Brian Hulley:
> Perhaps laziness is more "foundational", in that you can write
> 
>       if2 c x y = if c then x else y
> 
> However:
> 
> 1) What's the advantage of being able to define if2?

Well, you can easily define you own control structures (when,
unless etc). This feature is wildly used in combinator libraries.
Also, in a non-strict language recursive definitions are not
limited to function types. Users of parser combinators heavily rely
on this feature. Just try to define/use parsing combinators
ins a strict language. The problem with eager evaluation is
that it is too eager (expressions are sometimes evaluated too
early) just as the problem with lazy evaluation is that it
is too lazy (evaluations sometimes happen too late).

Cheers, Ralf


More information about the Haskell-Cafe mailing list