
The Proxy instance for Eq and Ord is deliberately lazy for the same sort of
reason.
It is, simply, the maximally defined version of the function and, like it
or not, folks with good intentions but bad design sense often still pass
undefineds for Proxy arguments when they are used to older APIs that didn't
take proxies.
The lazy version of each of these when inlined can eliminate whole code
paths that would otherwise be compiled.
-Edward
On Thu, Jul 16, 2015 at 8:29 AM, Edward Kmett
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
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
On 2015-07-16 at 05:28:03 +0200, David Feuer wrote: 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