[Haskell-cafe] Re: instance Eq (a -> b)
tom.davie at gmail.com
Wed Apr 14 04:03:34 EDT 2010
On 14 Apr 2010, at 08:29, Ashley Yakeley wrote:
> On Wed, 2010-04-14 at 08:13 +0100, Thomas Davie wrote:
>> Your instances of Finite are not quite right:
>> bottom :: a
>> bottom = doSomethingToLoopInfinitely.
>> instance Finite () where
>> allValues = [(), bottom]
> Bottom is not a value, it's failure to evaluate to a value.
> But if one did start considering bottom to be a value, one would have to
> distinguish different ones. For instance, (error "ABC") vs. (error
> "PQR"). Obviously this is not finite.
Certainly bottom is a value, and it's a value in *all* Haskell types. Of note, bottom is very important to this question – two functions are not equal unless their behaviour when handed bottom is equal.
We also don't need to distinguish different bottoms, there is only one bottom value, the runtime has different side effects when it occurs at different times though.
More information about the Haskell-Cafe