Re: Avoiding construction of dead dictionaries

2021-08-16 Thread Michael Sperber
On Thu, Aug 12 2021, Simon Peyton Jones wrote: > Repro case is something like > * Here is a source or files > * Compile like this > * Look at the generated Core...observe silly thing happening Tried my best here: https://gitlab.haskell.org/ghc/ghc/-/issues/20237 Any help on this would be

RE: Avoiding construction of dead dictionaries

2021-08-12 Thread Simon Peyton Jones via Glasgow-haskell-users
ll-users@haskell.org | Subject: Re: Avoiding construction of dead dictionaries | | | On Mon, Aug 09 2021, Simon Peyton Jones wrote: | | > Could you offer a small repro case, with a pointer to evidence that it | matters in practice, and open a ticket? | | I'll try my best, but I'm unsu

Re: Avoiding construction of dead dictionaries

2021-08-12 Thread Michael Sperber
On Mon, Aug 09 2021, Simon Peyton Jones wrote: > Could you offer a small repro case, with a pointer to evidence that it > matters in practice, and open a ticket? I'll try my best, but I'm unsure how I would generate evidence. Could you give me a hint? Is there any way to see how far

RE: Avoiding construction of dead dictionaries

2021-08-09 Thread Simon Peyton Jones via Glasgow-haskell-users
Hi Mike | The right-hand argument of <+ leads to a dictionary construction that is a | proof of a certain property, but the dictionary itself ends up being dead, | like so: | |case $w$dOpCon_r2kGJ ... |of |{ (# ww1_s27L3 #) -> ... } | ^ |

Re: Avoiding construction of dead dictionaries

2021-08-09 Thread Claude Heiland-Allen
Hi all, On 09/08/2021 16:31, Brandon Allbery wrote: We haven't figured out what they did, but the other day we had someone in #haskell with an infinite loop evaluating a dictionary. So apparently it is possible for a dictionary to be bottom somehow. I managed to do something like this once:

Re: Avoiding construction of dead dictionaries

2021-08-09 Thread Brandon Allbery
ut things would be a bit more uniform. If there was a real > advantage to doing this, it’d definitely be worth measuring the perf cost > (if any). > > > > Simon > > > > *From:* Glasgow-haskell-users *On > Behalf Of *Brandon Allbery > *Sent:* 09 August 2021 16:32

RE: Avoiding construction of dead dictionaries

2021-08-09 Thread Simon Peyton Jones via Glasgow-haskell-users
...@deinprogramm.de Subject: Re: Avoiding construction of dead dictionaries We haven't figured out what they did, but the other day we had someone in #haskell with an infinite loop evaluating a dictionary. So apparently it is possible for a dictionary to be bottom somehow. On Mon, Aug 9, 2021 at 1

Re: Avoiding construction of dead dictionaries

2021-08-09 Thread Brandon Allbery
We haven't figured out what they did, but the other day we had someone in #haskell with an infinite loop evaluating a dictionary. So apparently it is possible for a dictionary to be bottom somehow. On Mon, Aug 9, 2021 at 11:27 AM Tom Smeding wrote: > Hi Mike, > > > > But wouldn't that imply

Re: Avoiding construction of dead dictionaries

2021-08-09 Thread Tom Smeding
Hi Mike, > But wouldn't that imply that ghc can build dictionary-construction code > that evaluates to bottom? Can that happen? I assume no, but here the dictionary is embedded as a field in the GADT, right? So if the data value is bottom, there is not even a dictionary to be found, let alone

Re: Avoiding construction of dead dictionaries

2021-08-09 Thread Michael Sperber
Thanks for thinking about this one! On Fri, Aug 06 2021, Tom Smeding wrote: > Would it not be unsound for ghc to elide dictionary construction here? > After all, the right-hand side might actually be a bottom > (e.g. undefined) at run-time, in which case the pattern match cannot > succeed

Re: Avoiding construction of dead dictionaries

2021-08-06 Thread Tom Smeding
Would it not be unsound for ghc to elide dictionary construction here? After all, the right-hand side might actually be a bottom (e.g. undefined) at run-time, in which case the pattern match cannot succeed according to the semantics of Haskell. I suspect that if you make the pattern match lazy