[Haskell-cafe] Re: instance Eq (a -> b)

Ashley Yakeley ashley at semantic.org
Wed Apr 14 05:07:52 EDT 2010


Jonas Almström Duregård wrote:

> So the facts that
> (1) f == g
> (2) f undefined = 6
> (3) g undefined = undefined
> is not a problem?

This is not a problem. f and g represent the same moral function, they 
are just implemented differently. f is smart enough to know that its 
argument doesn't matter, so it doesn't need to evaluate it. g waits 
forever trying to evaluate its function, not knowing it doesn't need it.

-- 
Ashley Yakeley


More information about the Haskell-Cafe mailing list