[Haskell-cafe] Re: Why purely in haskell?
Lennart Augustsson
lennart at augustsson.net
Fri Jan 11 02:11:52 EST 2008
Some people seem to think that == is an equality predicate.
This is a big source of confusion for them; until they realize that == is
just another function returning Bool they will make claims like [1..]==[1..]
having an unnatural result.
The == function is only vaguely related to the equality predicate in that it
is meant to be a computable approximation of semantic equality (but since
it's overloaded it can be anything, of course).
-- Lennart
On Jan 10, 2008 10:34 AM, <jerzy.karczmarczuk at info.unicaen.fr> wrote:
> Achim Schneider:
>
> > jerzy.karczmarczuk asks what's wrong with:
> >> > [1..] == [1..]
> >>
> >> Whatever you may say more, this is neither obscure nor a bug. I still
> >> wait for a relevant example. But I don't insist too much...
> >>
> > It's not an example of a bug, but of a cause.
>
> A cause of WHAT?? This is a perfect, nice, runaway computation, which
> agrees with all dogmas of my religion.
>
> Now, if somebody says that the fact that some people find it difficult to
> grasp the essence of laziness, and THIS is a source of bugs, I may
> believe.
> But not the laziness itself. (For some people the (==) operator seems to
> be a permanent source of bugs.)
>
> The difference between fold and stricter fold' won't convince me either.
> People who want to use laziness must simply read the documentation...
>
> On the other hand, what Don Stewart pointed out, the inconsistency between
> enumFrom and enumFromTo, and the difference of behaviours when one passes
> from Int to Integer, now, this is another story, worrying a little...
> Thanks.
>
>
> Perhaps another example is more relevant, the tradeoffs space-time in the
> "optimized" version of the powerset generator...
>
> Jerzy Karczmarczuk
>
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20080110/1820696d/attachment.htm
More information about the Haskell-Cafe
mailing list