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 #) -> ... } | ^^^^^^^^^ | never used
GHC needs to figure out that $w$dOpCon_r2kGJ always terminates, without throwing an exception etc. That can't be too hard, and Sebastian Graf has thought about it quite a bit. Could you offer a small repro case, with a pointer to evidence that it matters in practice, and open a ticket? Thanks Simon | -----Original Message----- | From: Glasgow-haskell-users <glasgow-haskell-users-boun...@haskell.org> On | Behalf Of Michael Sperber | Sent: 06 August 2021 14:06 | To: glasgow-haskell-users@haskell.org | Subject: Avoiding construction of dead dictionaries | | [You don't often get email from sper...@deinprogramm.de. Learn why this is | important at http://aka.ms/LearnAboutSenderIdentification.] | | I have another optimization problem. ConCat includes this definition: | | (<+) :: Con a => (Con b => r) -> (a |- b) -> r r <+ Entail (Sub Dict) = r | | 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 #) -> ... } | ^^^^^^^^^ | never used | | Yet, ghc (8.10.4) never elides this code. (I'm naively assuming because of | the unboxed tuple, but actually have no clue.) | | Is there any chance of convincing ghc of erasing the dictionary | construction? | | Help would be much appreciated! | | -- | Regards, | Mike | | _______________________________________________ | Glasgow-haskell-users mailing list | Glasgow-haskell-users@haskell.org | https://nam06.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmail.haskel | l.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fglasgow-haskell- | users&data=04%7C01%7Csimonpj%40microsoft.com%7C301c6f15cc1142fc645908d95 | 8dc725a%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637638526127543532%7CUn | known%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJX | VCI6Mn0%3D%7C2000&sdata=fh2YiJ5NuDMPzpzzxsAL0MyceMFH0MuveNgvTo7ZNow%3D&a | mp;reserved=0 _______________________________________________ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/glasgow-haskell-users