RFC for a change in EmptyDataDecls instance deriving

Edward Kmett ekmett at gmail.com
Thu Jul 16 19:12:42 UTC 2015


Voids as a key in a map blow up for different reasons, namely that Data.Map
evaluates the key.

In any event my experience tends to run to the opposite direction, anything
that makes code less defined, forces results that don't need to be forced
or passes dictionaries that don't get used is something I tend to worry
about as it leads to code that is doing make-work.

Your attempt at using x == y => f x == f y is compelling on the surface but
falls apart when you push on it.

x == y = True implies f x == f y = _|_ for tons of things, absurd isn't
terribly special in this regard.

() == () = True
repeat () == repeat () = _|_

There is a distinction between definitional equality (=) and constructive,
testable, equality (==).

What we really want is x = y implies f x = f y, which holds here. even x ==
y implies f x = f y, holds here, just not x == y implies f x == f y.

-Edward

On Thu, Jul 16, 2015 at 2:53 PM, Erik Hesselink <hesselink at gmail.com> wrote:

> Well, things made *im*possible: you can't do silly things like use
> Voids as keys in a map, or look for Voids in a list, as that will
> expose the Voids for the lies that they are. But you're right, I doubt
> this is a very common use case. I guess it just feels wrong to me to
> consider 'let x = x in x' be equal to 'error "boo"'. It also fits with
> all other functions on Void, which, when receiving an argument, use
> something like 'absurd' on it to produce their answer. Which leads to
> another oddity: given 'v :: Void', if 'v == v = True', what about
> something like 'absurd v :: Int == absurd v'? That would be bottom,
> which again, seems weird to me.
>
> Note that I have no great arguments and no intention of breaking
> anyone's code, quite the opposite. So I'd be very interested to see
> if/how defining the Void Eq instance to return True can be benificial.
>
> Erik
>
> On Thu, Jul 16, 2015 at 6:33 PM, Edward Kmett <ekmett at gmail.com> wrote:
> > Do you have an example of a thing made possible by making them more
> strict?
> > =)
> >
> > -Edward
> >
> > -Edward
> >
> > On Thu, Jul 16, 2015 at 9:10 AM, Erik Hesselink <hesselink at gmail.com>
> wrote:
> >>
> >> Do you have an example of things made possible by the version returning
> >> True?
> >>
> >> Erik
> >>
> >> On Thu, Jul 16, 2015 at 2:29 PM, Edward Kmett <ekmett at gmail.com> wrote:
> >> > I'd caution against randomly changing Eq and Ord for Void to be less
> >> > defined
> >> > in the ill-considered name of consistency.
> >> >
> >> > We rather deliberately made them as "defined as possible" back in 2012
> >> > after
> >> > a very long discussion in which the pendulum swung the other way
> using a
> >> > few
> >> > examples where folks tied knots with fixed points to get inhabitants
> of
> >> > Void
> >> > and it was less consistent to rule them out than it was to define
> >> > equality
> >> > on _|_ to be True.
> >> >
> >> > I'd challenge that nothing is gained by making these combinators
> strict
> >> > in
> >> > their arguments.
> >> >
> >> > -Edward
> >> >
> >> > On Thu, Jul 16, 2015 at 7:14 AM, Herbert Valerio Riedel <hvr at gnu.org>
> >> > wrote:
> >> >>
> >> >> On 2015-07-16 at 05:28:03 +0200, David Feuer wrote:
> >> >> > It's all a bit weird. I think the Proxy instance is lazy too. I
> would
> >> >> > tend
> >> >> > to think that empty types shouldn't have these instances, and that
> if
> >> >> > they
> >> >> > do that should be strict (empty case), but I can't prove that's the
> >> >> > right
> >> >> > way.
> >> >>
> >> >> Btw, something similiar came up for deepseq, regarding NFData
> instances
> >> >> for types only inhabited by ⊥ (and the issue of H2010 forbidding
> >> >> instance auto-derivation for constructor-less types was mentioned
> too):
> >> >>
> >> >>  https://github.com/haskell/deepseq/pull/1#issuecomment-61914093
> >> >>
> >> >> -- hvr
> >> >
> >> >
> >> >
> >> > _______________________________________________
> >> > Libraries mailing list
> >> > Libraries at haskell.org
> >> > http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
> >> >
> >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20150716/4a05fb1e/attachment.html>


More information about the Libraries mailing list