Left-bias and non-structural equality.

Jean-Philippe Bernardy jeanphilippe.bernardy at gmail.com
Thu Jan 5 04:55:42 EST 2006


On 1/5/06, Christian Maeder <maeder at tzi.de> wrote:
> Jean-Philippe Bernardy wrote:
> > On 1/4/06, Christian Maeder <maeder at tzi.de> wrote:
> >> I would not like to drop biasing distinction, as I don't think this
> >> costs too much. With biasing, maps could be implemented via "biased
> >> sets" (Set (MapEntry a b)):
> >>
> >> data MapEntry a b = a := b
> >>
> >> instance Eq/Ord a => Eq/Ord (MapEntry a b) where
> >>     compare (a1 := _) (a2 := _) = compare a1 a2
> >
> > I would discourage such a use. This is exaclty why we provide Maps, after all.
>
> I still agree, but it might be nice to have for testing, comparison, and
> property specification purposes.
>
> Christian
>

Indeed, that's what I did to write the left-bias testing code. As it
is, we can choose to enable or disable ill-defined Eq it when testing
any given specific collection data-type.

Cheers,
JP.


More information about the Libraries mailing list