[Haskell-cafe] Re: instance Eq (a -> b)
Thomas Davie
tom.davie at gmail.com
Wed Apr 14 04:20:18 EDT 2010
On 14 Apr 2010, at 09:17, Ashley Yakeley wrote:
> Thomas Davie wrote:
>> Certainly bottom is a value, and it's a value in *all* Haskell types.
>
> This is a matter of interpretation. If you consider bottom to be a value, then all the laws fail. For instance, (==) is supposed to be reflexive, but "undefined == undefined" is not True for almost any type.
>
> For this reason I recommend "fast and loose reasoning":
> http://www.cs.nott.ac.uk/~nad/publications/danielsson-et-al-popl2006.html
It might be nice to have a definition of whether we consider bottom to be a value in Haskell then, because the definition of second and fmap on tuples are different because of this consideration:
fmap f (x,y) = (x,f y)
second f ~(x,y) = (x,f y)
Because we consider that the Functor laws must hold for all values in the type (including bottom).
Bob
More information about the Haskell-Cafe
mailing list