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

Nick Bowler nbowler at elliptictech.com
Thu Apr 15 09:18:36 EDT 2010


On 03:53 Thu 15 Apr     , roconnor at theorem.ca wrote:
> On Wed, 14 Apr 2010, Ashley Yakeley wrote:
> 
> > On 2010-04-14 14:58, Ashley Yakeley wrote:
> >> On 2010-04-14 13:59, roconnor at theorem.ca wrote:
> >> 
> >>> There is some notion of value, let's call it proper value, such that
> >>> bottom is not one.
> >>> 
> >>> In other words bottom is not a proper value.
> >>> 
> >>> Define a proper value to be a value x such that x == x.
> >>> 
> >>> So neither undefined nor (0.0/0.0) are proper values
> >>> 
> >>> In fact proper values are not just subsets of values but are also
> >>> quotients.
> >>> 
> >>> thus (-0.0) and 0.0 denote the same proper value even though they are
> >>> represented by different Haskell values.
> >> 
> >> The trouble is, there are functions that can distinguish -0.0 and 0.0.
> >> Do we call them bad functions, or are the Eq instances for Float and
> >> Double broken?
> 
> I'd call them disrespectful functions, or maybe nowadays I might call them
> improper functions.  The "good" functions are respectful functions or
> proper functions.

<snip from other post>
> Try using the (x == y) ==> (f x = g y) test yourself.

Your definitions seem very strange, because according to this, the
functions

  f :: Double -> Double
  f x = 1/x

and 

  g :: Double -> Double
  g x = 1/x

are not equal, since (-0.0 == 0.0) yet f (-0.0) /= g (0.0).

-- 
Nick Bowler, Elliptic Technologies (http://www.elliptictech.com/)


More information about the Haskell-Cafe mailing list